Synopsis
Test & Code is a weekly podcast hosted by Brian Okken.The show covers a wide array of topics including software development, testing, Python programming, and many related topics. When we get into the implementation specifics, that's usually Python, such as Python packaging, tox, pytest, and unittest. However, well over half of the topics are language agnostic, such as data science, DevOps, TDD, public speaking, mentoring, feature testing, NoSQL databases, end to end testing, automation, continuous integration, development methods, Selenium, the testing pyramid, and DevOps.
Episodes
-
137: Become an Author - Matt Harrison interviews Brian Okken
05/11/2020 Duration: 40minMatt Harrison, author of many Python books, is putting together a course, Effective Book Authoring, to help other people write and publish books. As part of this course, he's including interviews with people who have already written books, including me. This is that interview.We discuss:Why I wrote "Python Testing with pytest"Self publishing vs working with a publisherThe writing, editing, and publishing processWriting formatBook promotionAdvice to other writersSpecial Guest: Matt Harrison.Links:Effective Book Authoring — Matt's coursePython Testing with pytest - Simple, Rapid, Effective, and Scalable
-
136: Wearable Technology - Sophy Wong
26/10/2020 Duration: 29minWearable technology is not just smart consumer devices like watches and activity trackers. Wearable tech also includes one off projects by designers, makers, and hackers and there are more and more people producing tutorials on how to get started. Wearable tech is also a great way to get both kids and adults excited about coding, electronics, and in general, engineering skills. Sophy Wong is a designer who makes really cool stuff using code, technology, costuming, soldering, and even jewelry techniques to get tech onto the human body. Sophy joins the show to answer my many questions about getting started safely with wearable tech.Some of the questions and topics:Can I wash my clothing if I've added tech to it?Is there any danger in wearing technology or building wearable tech?Are there actual wires and cables conductive thread in the fabric and textiles of some wearable tech projects?What's a good starter project? Especially if I want to do a wearable tech project with my kids?Dealing with stretch with clothi
-
135: Speeding up Django Test Suites - Adam Johnson
20/10/2020 Duration: 21minAll test suites start fast. But as you grow your set of tests, each test adds a little bit of time to the suite. What can you do about it to keep test suites fast? Some things, like parallelization, are applicable to many domains. What about, for instance, Django applications? Well, Adam Johnson has thought about it a lot, and is here to tell us how we can speed up our Django test suites. Topics include:parallelizing testsmoving from disk to memoryusing fake data and factory functionstargeted mockingSpecial Guest: Adam Johnson.Links:Speed Up Your Django Tests — the book by Adam JohnsonKukicha — "or twig tea, ..., is a Japanese blend made of stems, stalks, and twigs."
-
134: Business Outcomes and Software Development - Benjamin Harding
12/10/2020 Duration: 29minWithin software projects, there are lots of metrics we could measure. But which ones really matter. Instead of a list, Benjamin Harding shares with us a way of thinking about business outcomes that can help us with every day decision making. We talk about:Business outcomes vs vanity metricsAs a developer, how do you keep business outcomes in mindThinking about customer value all the timeCommunicating decisions and options in terms of costs and impact on business outcomesCompany culture and it's role in reinforcing a business outcome mindsetAnd even the role of team lead as impact multiplier I really enjoyed this conversation. But I admit that at first, I didn't realize how important this is on all software development. Metrics are front and center in a web app. But what about a service, or an embedded system with no telemetry. It still matters, maybe even more so. Little and big decisions developers face every day that have impact on costs and benefits with respect to customer value and business outcome, even
-
133: Major League Hacking - Jon Gottfried
05/10/2020 Duration: 26minHackathons have been spreading around the world; many at university campuses. Major League Hacking, MLH, has been encouraging and helping hackathons.Hacking can be thought of as tinkering. Taking things apart and putting them back together as an interesting experience. There's always been some of this as part of software culture.The people at Major League Hacking have taken this to a whole new level, bringing together Tech creators who enjoy playing around with and crating new technology, on campuses, and now in virtual spaces, all over the world.Jonathon Gottfried, one of the cofounders of Major League Hacking, joins the show to talk about:hacker meetups and eventshackathonswhat it's like to go to a hackathonhow to help out with hackathons as an experienced engineer, even virtually as a mentorhackathons continuing virtually during the pandemicinternships and fellowships on open source projects to help students gain experience, even during the pandemicMLH approach to internships, giving interns a support grou
-
132: mocking in Python - Anna-Lena Popkes
28/09/2020 Duration: 38minUsing mock objects during testing in Python.Anna-Lena joins the podcast to teach us about mocks and using unittest.mock objects during testing. We discuss:the different styles of using mockspros and cons of mocksdependency injectionadapter patternmock hellmagical universeand much moreSpecial Guest: Anna-Lena Popkes.Links:Personal webpage of Anna-Lena PopkesMagical Universe — Awesome Python features explained using the world of magicTest & Code 102: Cosmic Python, TDD, testing and external dependencies — The episode where Harry Percival discusses mocking.Talk: Harry Percival - Stop Using Mocks (for a while) - YouTube — Talk: Harry Percival - Stop Using Mocks (for a while)unittest.mock AutospeccingMock Hell Talk (45 min version) Edwin Jung - PyCon 2019 Mock Hell Talk (30 min version) - Edwin Jung - PyConDE PyCon EstoniaKI macht Schule!Talk Python #186 : 100 Days of Python in a Magical Universe
-
131: Test Smarter, Not Harder
21/09/2020 Duration: 07minSome people avoid writing tests. Some drudge through it painfully. There is a better way. In this episode, I'm going to share some advice from Luke Plant on how to "Test Smarter, Not Harder".Links:Test smarter, not harder - lukeplant.me.uk — The original article by Luke
-
130: virtualenv activation prompt consistency across shells - an open source dev and test adventure - Brian Skinn
13/09/2020 Duration: 33minvirtualenv supports six shells: bash, csh, fish, xonsh, cmd, posh. Each handles prompts slightly differently. Although the virtualenv custom prompt behavior should be the same across shells, Brian Skinn noticed inconsistencies. He set out to fix those inconsistencies. That was the start of an adventure in open source collaboration, shell prompt internals, difficult test problems, and continuous integration quirks. Brian Skinn initially noticed that on Windows cmd, a space was added between a prefix defined by --prompt and the rest of the prompt, whereas on bash no space was added.For reference, there were/are three nominal virtualenv prompt modification behaviors, all of which apply to the prompt changes that are made at the time of virtualenv activation:If the environment variable VIRTUAL_ENV_DISABLE_PROMPT is defined and non-empty at activation time, do not modify the prompt at all. Otherwise: If the --prompt argument was supplied at creation time, use that argument as the prefix to apply to the prompt; or,
-
129: How to Test Anything - David Lord
07/09/2020 Duration: 40minI asked people on twitter to fill in "How do I test _____?" to find out what people want to know how to test. Lots of responses. David Lord agreed to answer them with me. In the process, we come up with lots of great general advice on how to test just about anything.Specific Questions people asked:What makes a good test?How do you test web app performance?How do you test cookie cutter templates?How do I test my test framework? How do I test permission management?How do I test SQLAlchemy models and pydantic schemas in a FastAPI app?How do I test warehouse ETL code?How do I test and mock GPIO pins on hardware for code running MicroPython on a device?How do I test PyQt apps?How do I test web scrapers?Is it the best practice to put static html in your test directory or just snippets stored in string variables?What's the best way to to test server client API contracts?How do I test a monitoring tool?We also talk about:What is the Flask testing philosophy?What do Flask tests look like?Flask and Pallets using pytest
-
128: pytest-randomly - Adam Johnson
28/08/2020 Duration: 15minSoftware tests should be order independent. That means you should be able to run them in any order or run them in isolation and get the same result.However, system state often gets in the way and order dependence can creep into a test suite. One way to fight against order dependence is to randomize test order, and with pytest, we recommend the plugin pytest-randomly to do that for you.The developer that started pytest-randomly and continues to support it is Adam Johnson, who joins us today to discuss pytest-randomly and another plugin he also wrote, called pytest-reverse.Special Guest: Adam Johnson.Links:pytest-randomly: pytest plugin to randomly order tests and control random.seedpytest-reverse: pytest plugin to reverse test order.Empirically revisiting the test independence assumptionpytest-xdistfactory_boy FakerNumPyHyrum's Law
-
127: WFH, WTF? - Tips and Tricks for Working From Home - Reuven Lerner & Julian Sequeira
24/08/2020 Duration: 40minMany people have been working from home now that are not used to working from home. Or at least are working from home more than they ever did before. That's definitely true for me. Even though I've been working from home since March, I wanted some tips from people who have been doing it longer.Julian Sequeira, of PyBites fame, has been working from home for about a year. Reuven Lerner, an amazing Python trainer, has been working from home for much longer.We originally had a big list of WFH topics. But we had so much fun with the tips and tricks part, that that's pretty much the whole episode.But there's lots of great tips and tricks, so I'm glad we focused on that.Special Guests: Julian Sequeira and Reuven Lerner.Links:PyBites — Julian's site for teaching PythonTeaching Python and data science around the world — Reuven LernerBonbon - WikipediaTest & Code Mailing List — Join for your chance to win a free course from Talk Python Training. One course given away every week for 6 weeks.
-
126: Data Science and Software Engineering Practices ( and Fizz Buzz ) - Joel Grus
17/08/2020 Duration: 31minResearches and others using data science and software need to follow solid software engineering practices. This is a message that Joel Grus has been promoting for some time.Joel joins the show this week to talk about data science, software engineering, and even Fizz Buzz.Topics include:Software Engineering practices and data scienceDifficulties with Jupyter notebooksCode reviews on experiment codeUnit tests on experiment codeFinding bugs before doing experimentsTests for data pipelinesTests for deep learning models Showing researchers the value of tests by showing the bugs found that wouldn't have been found without them."Data Science from Scratch" book Showing testing during teaching Data Science"Ten Essays on Fizz Buzz" book Meditations on Python, mathematics, science, engineerign and designTesting Fizz BuzzDifferent algorithms and solutions to an age old interview question.If not Fizz Buzz, what makes a decent coding interview question.pytesthypothesisMath requirements for data scienceSpecial Guest: Joel G
-
125: pytest 6 - Anthony Sottile
07/08/2020 Duration: 59minpytest 6 is out. Specifically, 6.0.1, as of July 31. And there's lots to be excited about. Anthony Sottile joins the show to discuss features, improvements, documentation updates and more.Full release notes / changelogSome of what we talk about:How to update (at least, how I do it) Run your test suites with 5.4.3 or whatever the last version you were usingUpdate to 6Run again. Same output? Probably good.If there are any warnings, maybe fix those.You can also run with pytest -W error to turn warnings into errors.Then find out all the cool stuff you can do nowNew Features pytest now supports pyproject.toml files for configuration. but remember, toml syntax is different than ini files. mostly quotes are needed pytest now includes inline type annotations and exposes them to user programs. Most of the user-facing API is covered, as well as internal code.New command-line flags --no-header and --no-summaryA warning is now shown when an unknown key is read from a config INI file. The --strict-config flag has been add
-
124: pip dependency resolver changes
03/08/2020 Duration: 42minpip is the package installer for Python. Often, when you run pip, especially the first time in a new virtual environment, you will see something like:WARNING: You are using pip version 20.1.1; however, version 20.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.And you should. Because 20.2 has a new dependency resolver.Get in the habit, until October, of replacing pip install with pip install --use-feature=2020-resolver. This flag is new in the 20.2 release.This new pip dependency resolver is the result of a lot of work. Five of the people involved with this work are joining the show today: Bernard Tyers, Nicole Harris, Paul Moore, Pradyun Gedam, and Tzu-ping Chung. We talk about: pip dependency resolver changesuser experience research and testingcrafting good error messagesefforts to improve the test suitetesting pip with pytestsome of the difficulties with testing pipworking with a team on a large projectworking with a large code basebringing new developers
-
123: GitHub Actions - Tania Allard
24/07/2020 Duration: 22minLots of Python projects are starting to use GitHub Actions for Continous Integration & Deployment (CI/CD), as well as other workflows.Tania Allard, a Senior Cloud Developer Advocate at Microsoft, joins the show to answer some of my questions regarding setting up a Python project to use Actions.Some of the topics covered:How to get started with GitHub Actions for a Python project?What are workflow files?Does it matter what the file name is called?Can I have / Should I have more than one workflow?Special Guest: Tania Allard.Links:Using Python with GitHub Actions - GitHub Docsawesome-actions — A curated list of awesome actions to use on GitHub
-
122: Better Resumes for Software Engineers - Randall Kanna
16/07/2020 Duration: 35minA great resume is key to landing a great software job. There's no surprise there. But so many people make mistakes on their resume that can very easily be fixed.Randall Kanna is on the show today to help us understand how to improve our resumes, and in turn, help us have better careers.Special Guest: Randall Kanna.Links:The Standout Developer — link includes discount
-
121: Industrial 3D Printing & Python, Finite State Machines, and Simulating Hardware - Len Wanger
10/07/2020 Duration: 46minLen Wanger works on industrial 3D printers. And I was pleased to find out that there's a bunch of Python in those printers as well. In this episode we talk about:3D printersWhat are the different types of 3D printers?Where are 3D printed industrial parts being used?Why use one type of additive manufacturing over another?Python in 3D printing hardware.What are Finite State Machines, FSMs?Benefits of FSMs for testing, logging, and breaking a complex behavior into small testable parts.Benefits of simulation in writing and testing software to control hardware.Special Guest: Len Wanger.Links:pystate — Python package for co-routine base state machinesImpossible Objects — Composite 3D PrintingFinite-state machine, FSM
-
120: FastAPI & Typer - Sebastián Ramírez
03/07/2020 Duration: 43minFastAPI is a modern, fast (high-performance), web framework for building APIs with Python based on standard Python type hints. Typer is a library for building CLI applications, also based on Python type hints. Type hints and many other details are intended to make it easier to develop, test, and debug applications using FastAPI and Typer.The person behind FastAPI and Typer is Sebastián Ramírez.Sebastián is on the show today, and we discuss:FastAPIRest APIsSwagger UIFuture features of FastAPIStarletteTyperClickTesting with Typer and ClickTyper autocompletionTyper CLISpecial Guest: Sebastián Ramírez.Links:ExplosionFastAPITyperOpenAPI Specification JSON SchemaOAuth 2.0StarlettepydanticSwagger UI — REST API Documentation ToolTesting - TyperClickTesting Click ApplicationsCLI Option autocompletion - TyperTyper CLI - completion for small scripts
-
119: Editable Python Installs, Packaging Standardization, and pyproject.toml - Brett Cannon
26/06/2020 Duration: 34minThere's stuff going on in Python packaging and pyproject.toml.Brett and I talk about some upcoming work on Python packaging, such as:editable installsthe need for standardizationconfiguration of other tools in pyproject.tomlAnd then get off on tangents and talk about:why it's good to have packages like pip, toml, setuptools, wheel, etc not part of the standard libraryshould we remove some stuff from the standard librarythe standard library using unittest for testing the standard library why not hypothesisI didn't bring up "why not pytest?" but you know I was thinking it.why CPython and not C++Pythonand moreSpecial Guest: Brett Cannon.Links:episode 52: pyproject.toml : the future of Python packaging - Brett CannonPython Packaging AuthorityPEP 517 -- A build-system independent format for source treesPEP 518 -- Specifying Minimum Build System Requirements for Python ProjectsWhat the heck is pyproject.toml?Flit PoetryensconstomlsetuptoolsdistutilspipHTTPX
-
118: Code Coverage and 100% Coverage
26/06/2020 Duration: 42minCode Coverage or Test Coverage is a way to measure what lines of code and branches in your code that are utilized during testing. Coverage tools are an important part of software engineering. But there's also lots of different opinions about using it. Should you try for 100% coverage? What code can and should you exclude? What about targets?I've been asked many times what I think about code coverage or test coverage. This episode is a train of thought brain dump on what I think about code coverage.We'll talk about:how I use code coverage to help me write source codeline coverage and branch coveragebehavior coverageusing tests to ask and answer questions about the system under testhow to target coverage just to the code you care aboutexcluding codegood reasons and bad reasons to exclude codeAnd also the Pareto Principle or 80/20 rule, and the law of diminishing returns and how that applies (or doesn't) to test coverage.Links:Coverage.pypytest-cov