Test & Code

Test & Code

Download on the App Store

Test & Code episodes

  • 167: React, TypeScript, and the Joy of Testing - Paul Everitt

    Paul has a tutorial on testing and TDD with React and TypeScript. 
     We discuss workflow and the differences, similarities between testing with React/TypeScript and Python.
     We also discuss what lessons that we can bring from front end testing to Python testing.


    Special Guest: Paul Everitt.


    Links:

    • React, TypeScript, and TDD — Paul Everitt's tutorial
    • React Testing Library



    38 min
  • 166: unittest expectedFailure and xfail

    xfail isn't just for pytest tests. Python's unittest has @unittest.expectedFailure.

    In this episode, we cover:

    • using @unittest.expectedFailure
    • the results of passing and failing tests with expectedFailure
    • using pytest as a test runner for unittest
    • using pytest markers on unittest tests

    Docs for expectedFailure:
     https://docs.python.org/3/library/unittest.html#skipping-tests-and-expected-failures

    Some sample code. 
     unittest only:

    import unittest
    class ExpectedFailureTestCase(unittest.TestCase):
    @unittest.expectedFailure
    def test_fail(self):
    self.assertEqual(1, 0, "broken")
    @unittest.expectedFailure
    def test_pass(self):
    self.assertEqual(1, 1, "not broken")

    unittest with pytest markers:

    import unittest
    import pytest
    class ExpectedFailureTestCase(unittest.TestCase):
    @pytest.mark.xfail
    def test_fail(self):
    self.assertEqual(1, 0, "broken")
    @pytest.mark.xfail
    def test_pass(self):
    self.assertEqual(1, 1, "not broken")






    7 min
  • 165: pytest xfail policy and workflow

    A discussion of how to use the xfail feature of pytest to help with communication on software projects.

    The episode covers:

    • What is xfail
    • Why I use it
    • Using reason effectively by including issue tracking numbers
    • Using xfail_strict
    • Adding --runxfail when transitioning from development to feature freeze
    • What to do about test failures
    • How all of this might help with team communication





    10 min
  • 164: Debugging Python Test Failures with pytest

    An overview of the pytest flags that help with debugging.
     From Chapter 13, Debugging Test Failures, of Python Testing with pytest, 2nd edition.

    pytest includes quite a few command-line flags that are useful for debugging. 

    We talk about thes flags in this episode.

    Flags for selecting which tests to run, in which order, and when to stop:

    • -lf / --last-failed: Runs just the tests that failed last.
    • -ff / --failed-failed: Runs all the tests, starting with the last failed.
    • -x / --exitfirst: Stops the tests session afterEd: after?Author: yep the first failure.
    • --maxfail=num: Stops the tests after num failures.
    • -nf / --new-first: Runs all the tests, ordered by file modification time.
    • --sw / --stepwise: Stops the tests at the first failure. Starts the tests at the last failure next time.
    • --sw-skip / --stepwise-skip: Same as --sw, but skips the first failure.

    Flags to control pytest output:

    • -v / --verbose Displays all the test names, passing or failing.
    • --tb=[auto/long/short/line/native/no] Controls the traceback style.
    • -l / --showlocals Displays local variables alongside the stacktrace.

    Flags to start a command-line debugger:

    • --pdb Starts an interactive debugging session at the point of failure.
    • --trace Starts the pdb source-code debugger immediately when running each test.
    • --pdbcls Uses alternatives to pdb, such as IPython’s debugger with –-pdbcls=IPython.terminal.debugger:TerminalPdb.

    This list is also found in Chapter 13 of Python Testing with pytest, 2nd edition.
    The chapter is "Debugging Test Failures" and covers way more than just debug flags, while walking through debugging 2 test failures.


    Links:

    • Python Testing with pytest — The fastest way to get up to speed on pytest.
    • all pytest flags in pytest 6.2.x



    13 min
  • 163: pip install ./local_directory - Stéphane Bidoul

    pip : "pip installs packages" or maybe "Package Installer for Python"
     pip is an invaluable tool when developing with Python.
     A lot of people know pip as a way to install third party packages from pypi.org
     You can also use pip to install from other indexes (or is it indices?)

    You can also use pip to install a package in a local directory.
     That's the part I want to jump in and explore with Stéphane Bidoul.
     The way pip installs from a local directory is about to change, and the story is fascinating.


    Special Guest: Stéphane Bidoul.


    Links:

    • The Odoo Community Association
    • PEP 610 -- Recording the Direct URL Origin of installed distributions | Python.org
    • PEP 660 -- Editable installs for pyproject.toml based builds (wheel based) | Python.org — Bidoul
    • pip install --no-index --find-links 
    • Solving issues related to out-of-tree builds · Issue #7555 · pypa/pip
    • pip list json format



    29 min
  • 162: Flavors of TDD

    What flavor of TDD do you practice? 

    In this episode we talk about:

    • Classical vs Mockist TDD
    • Detroit vs London (I actually refer to it in the episode as Chicago instead of Detroit. Oh well.)
    • Static vs Behavior
    • Inside Out vs Outside In
    • Double Loop TDD
    • BDD
    • FDD
    • Tracer Bullets
    • Rules of TDD
    • Team Structure
    • Lean TDD 

    This is definitely an episode I'd like feedback on. Reach out to me for further questions or if I missed some crucial variant of TDD that you know and love.


    Links:

    • Mocks Aren't Stubs - Martin Fowler
    • Mockists Are Dead. Long Live Classicists.
    • Double Loop TDD
    • BDD: Behavior-driven development
    • FDD: Feature-driven development
    • My reaction to “Is TDD Dead?” - pythontest.com
    • Test First Programming / Test First Development
    • Humorous list of TDD variants — BDD = Buzzword Driven Development, CDD = Calendar Driven Development, etc



    22 min
  • 161: Waste in Software Development

    Software development processes create value, and have waste, in the Lean sense of the word waste.
     Lean manufacturing and lean software development changed the way we look at value and waste.
     This episode looks at lean definitions of waste, so we can see it clearly when we encounter it.

    I'm going to use the term waste and value in future episodes. I'm using waste in a Lean sense, so we can look at software processes critically, see the value chain, and try to reduce waste.

    Lean manufacturing and lean software development caused people to talk about and examine waste and value, even in fields where we didn't really think about waste that much to begin with.

    Software is just ones and zeros. Is there waste? 
     When I delete a file, nothing goes into the landfill.

    The mistake I'm making here is confusing the common English definition of waste when what we're talking about is the Lean definition of waste.

    This episode tries to clear up the confusion.


    Links:

    • Big Design Up Front
    • Lightweight Methodologies
    • Manifesto for Agile Software Development
    • Extreme programming
    • The New Methodology
    • Test First Programming / Test First Development
    • Test Driven Development
    • The Pragmatic Programmer
    • Six Sigma
    • DMAIC
    • Lean software development
    • Lean manufacturing
    • The Toyota Way
    • Lean Six Sigma
    • Definition of Waste by Merriam-Webster



    19 min
  • 160: DRY, WET, DAMP, AHA, and removing duplication from production code and test code

    Should your code be DRY or DAMP or something completely different?
     How about your test code? Do different rules apply?
     Wait, what do all of these acronyms mean?

    We'll get to all of these definitions, and then talk about how it applies to both production code and test code in this episode. 


    Links:

    • The Pragmatic Programmer, 20th Anniversary Edition
    • Don't repeat yourself - Wikipedia
    • a-ha - Take On Me
    • Rule of three - Wikipedia
    • What does “DAMP not DRY” mean when talking about unit tests? - Stack Overflow



    15 min
  • 159: Python, pandas, and Twitter Analytics - Matt Harrison

    When learning data science and machine learning techniques, you need to work on a data set.
     Matt Harrison had a great idea: Why not use your own Twitter analytics data?
     So, he did that with his own data, and shares what he learned in this episode, including some of his secrets to gaining followers.

    In this episode we talk about:

    • Looking at your own Twitter analytics data.
    • Using Python, pandas, Jupyter for data cleaning and exploratory analysis
    • Data visualization
    • Machine learning, principal component analysis, clustering
    • Model drift and re-running analysis
    • What kind of tweets perform well
    • And much more

    Links:

    • Applied Pandas: Twitter Analytics — the course





    47 min

About Test & Code

From the publisher's feed

The Python Test Podcast hosted by Brian Okken

More shows like Test & Code

Radiolab by WNYC Studios

Radiolab

43,853 Listeners

Software Engineering Daily by Software Engineering Daily

Software Engineering Daily

623 Listeners

Heavy Networking by Packet Pushers

Heavy Networking

327 Listeners

Talk Python To Me by Michael Kennedy

Talk Python To Me

582 Listeners

Python Bytes by Michael Kennedy and Calvin Hendryx-Parker

Python Bytes

213 Listeners

Darknet Diaries by Jack Rhysider

Darknet Diaries

8,059 Listeners

The Real Python Podcast by Real Python

The Real Python Podcast

139 Listeners

Unexplainable by Vox

Unexplainable

2,313 Listeners

Network Automation Nerds by Packet Pushers

Network Automation Nerds

5 Listeners