PyCon Canada 2018 Reflections

PyCon Canada 2018 was my fourth and final Python conference of 2018. I proposed a talk on a whim after seeing the CFP on Twitter. What the heck, why not? It couldn’t hurt to try. Much to my surprise (and delight), I was accepted to speak! So, up to the Great White North I went for the first time since childhood.

The Conference

#PyConCA2018 took place in Toronto, Ontario from November 10-13 at the Chestnut Residence downtown. I attended the conference (Nov 10-11) but skipped out on the sprints (Nov 12-13). It looked like about 400-500 people attended the conference, but I don’t know the exact count. A few vendors had tables with swag, but the talks were clearly the main focus of the conference.

A great view of downtown Toronto from my Chinatown Airbnb

The Talks

PyConCA offered three tracks for talks plus a tutorials track. There were two time slot lengths for talks: 10 minutes and 30 minutes. I had not attended a conference with short 10-minute talks before, but they turned out to be a great way to cover a broader range of topics in a short amount of time. The tutorials were long-running sessions for which anyone could register at no additional charge, but they each had a limited number of seats. (I regret not signing up in advance for the Kubernetes tutorial.) There were also four decent keynote addresses.

I attended the following talks:

  1. A Bossy Sort of Voice: Uncovering gender bias in Harry Potter with Python
  2. Replacing Guido
  3. Guide to your own artificial intelligence application in 3 easy steps
  4. Who’s There? Building a home security system with Pi & Slack!
  5. PEP 572: The Walrus Operator
  6. WSGI for Web Developers
  7. Get Productive with Python in Visual Studio Code
  8. Lessons learned open sourcing (and maintaining) my first library
  9. Nimble Testing!

My Talk

My talk was entitled, “Behavior-Driven Python with pytest-bdd”. It was a recasting of my PyCon 2018 talk on Python’s behave framework using pytest-bdd instead.

Prepping for my talk at my Airbnb with my toque and Royaltea glass!

I spent a lot of time reworking the slides, writing new example code, and rehearsing my words before the talk. And I felt great when I presented it: without any script, I hit all the major points without skipping a beat and ended right on time. I felt my passion flow through me as I spoke. This tweet pretty much summed up my feelings:

The People

Meeting people is one of my favorite parts of Python conferences. Everyone is friendly. Everyone will chat with you. Everyone will get excited about whatever makes you excited. This time around, I ended up in a posse with a few other guys who mostly attended the same talks and also sat at the same lunch table. I hope our paths cross again. I also got to meet Elaine Wong, the conference chair.

After the Conference

I was on my own for both evenings after the conference talks. My Airbnb rental was just two blocks away in Chinatown, so I could walk to and from the conference center (in the bitter Toronto cold). On Saturday night, I ate a delicious dry hotpot of beef, lotus flowers, and wood ear mushrooms at the House of Gourmet, followed by a fancy bubble tea in a light-bulb-shaped glass across the street at Royaltea. On Sunday night, I treated myself to foot-and-body massage at Evergreen Beauty and Wellness. My therapist, who was from Beijing, helped me practice my Mandarin. Thereafter, I went to Sichuanren for an all-you-can-eat hotpot buffet: beef, pork, lamb, seafood, and veggies. It’s so much fun to visit a big city with a large Chinatown – it provides access to things I can’t always get at home. That US-to-Canadian-dollar exchange rate is quite favorable, too. The only challenges I faced were (a) no mobile phone service and (b) worrying if establishments would accept my credit/debit cards. The temps also hovered around freezing.


PyConCA was a strong finish for my 2018 conferences. I’m so thankful for my opportunity to speak, and I’m glad that I took the time to attend.

My favorite physical takeaway items of swag were:

  • My PyConCA sticker, now proudly displayed on my Macbook
  • My PyConCA t-shirt, which will soon appear in my rotation
  • My PyConCA “toque” (Canadian word for “knit winter cap with a pom-pom on top”)
One more badge, and one more sticker!

My main inspirational takeaway from this conference could be summed up in one word: confidence. I feel much more confident in myself as a conference speaker after nailing my talk this fourth time. After listening to a number of talks, I also feel much more confident in my Python web development skills. Picking up Flask (which is on my todo list) should be doable. Finally, I feel capable of learning data science and AI with Python when the time comes. Many talks showed how machine learning can solve novel problems with straightforward tools and techniques.

That should conclude this panda’s round of conferences for the year. I look forward to what 2019 brings!

PyTexas 2019 Reflections

PyTexas 2019 was an incredible Python conference. It was held at the Central Library in Austin, Texas from April 13-14. I’m so glad I went. Even though this was my seventh Python conference, it was one of my favorites so far. Here’s a brief recap of my experiences.

Why I Went

I consider myself very fortunate to have been able to go to PyTexas 2019. After my talk proposals for PyCon 2019 were rejected, I saw this tweet from Dustin Ingram, the conference chair for PyTexas:

Reinvigorated, I decided to give it a try. Lo and behold, one of my talks, Egad! How Do We Start Writing (Better) Tests?, was accepted! The video recording is below:

Thankfully, my talk was the very second talk of the conference. I could get it out of the way early so I could enjoy the rest of the conference without the nerves. And everyone always loves the pandas.

I also gave a Lightning Talk for the first time! I talked about the difference between unittest and pytest. My talk starts at 30:17, but be sure to listen to all of the talks.

I’d also like to thank my employer, PrecisionLender, for sponsoring my trip and enabling me to speak.

Memorable Moments

Talks are usually the main part of any conference. PyTexas 2019 was a single-track conference, meaning that everyone saw all of the talks. All talks were memorable for me, but I’ll write a separate post about the talks once all the recordings are posted. Here, I’ll cover other awesome things that happened.

My Recovery Day

Things had been very stressful for me in the first few months of 2019. I came to PyTexas essentially exhausted from life, and I needed a “Self Care Sprint” (as Kojo would say). So, that’s exactly what I did: I flew into Austin on Friday morning and spent the whole afternoon just being a low-key tourist. I ate a Texas-sized lunch at Stubb’s BBQ, viewed the artwork at Mexic-Arte Museum, walked along the Colorado River, and nearly fell asleep in the Central Library after perusing the stacks. That evening, I met up with other speakers at the Spider House for an informal pre-conference get-together. Even though I wasn’t “productive” by any professional definition, I felt thoroughly refreshed and ready for the excitement to come.

Electric Scooters

Austin has been invaded by electric scooters. They are on every street corner. There must be half a dozen different brands. Even Uber and Lyft have scooters for rent! Instead of hailing ride shares downtown, I just hopped the nearest Lime scooter. They go really fast, and they’re tons of fun!

The First After-Party

Literati Books generously hosted an after-party at Jo’s Coffee after the first day of the conference. I got to spend time with a bunch of cool people from the conference while enjoying sliders and craft beer. Carl even shared some of his jerky with us!

Other Testing Talks

I always get a rise out of testing talks at conferences. Python conferences always have a few but only a few. PyTexas had three. I think Kojo‘s tweets summed up my enthusiasm perfectly:

The Zen of Python Teams

Adrienne delivered one of the best keynote addresses I’ve ever attended. Seriously, go watch it. She talked about how the Zen of Python can be applied not only to code but also to teams. The best part was the “Easter egg” at the end. The Zen of Python famously leaves the 20th line blank so that we can make it for ourselves. Adrienne challenged us to come up with our own 20th point after handing out real Easter eggs to everyone in the audience! Mine? People matter.


I had never eaten at Whataburger before. This trip, that changed. William, Brian, and I hopped on those electric scooters and went to the Whataburger across the river for lunch on day 2. The patty melt was tasty, but the Dr. Pepper milkshake was out of this world! The views from the bridge were gorgeous as well.

The Second After-Party

After the conference ended, William, Aly, and I went to Mort Subite, a cool Belgian beer bar, to celebrate and unwind. Then, we rode electric scooters over to Baton Creole for a late-night dinner with Adrienne. We had some good food and even better discussions. It was the best way to end PyTexas!


PyTexas was the first conference where I felt like I fully belonged from day one. Every previous conference was a bit of a shot in the dark for me because I was still new to the Python community. PyTexas 2019 felt almost like a reunion. I strengthened existing friendships and made new ones: Adrienne, Kojo, Dustin, Ernest, Aly, William, Piper, Andy, Carl, Mason, Michael, Brian, and so many more. I also felt like I made a bigger impact at PyTexas than at other conferences because I genuinely felt like part of the community.

We should never take conferences (or any moments) for granted. Truly wonderful things happened at PyTexas. I felt creative. I felt inspired. I felt challenged by new ideas. I felt the itch to try new things. I left on a post-conference high and, surprisingly, I wasn’t particularly tired. The organizers did a phenomenal job running the conference smoothly and successfully. Seriously, hats off to them – many thanks for a job well done. As attendees, we should be grateful for all the hard work so many people did for the conference, and we should capitalize on what we take away from the conference.

Single-track and multi-track yield two very different conference experiences. PyTexas 2019 was my second single-track conference and my first one for a Python conference. Overall, I think the single-track format worked very well. Putting everyone on the same track in the same room builds a strong sense of camaraderie. It also gives speakers a much more prominent platform. However, multi-track provides more choices for attendees, and it gives more people the opportunity to speak. Both are good. I think it would be cool if future conferences do both: maybe one day for single-track and another day for multi-track.

I’m going to (attempt to) develop a new Python package. For a while, I’ve wanted to implement a particular testing pattern in a Pythonic way. My goal is to develop and release it to PyPI as an open-source package. I never had the time or clarity to do it until now. PyTexas gave me a huge boost, and I hope I can carry my vision through to delivery!

People matter. The Python community is a truly wonderful group. People come for the language and stay for the community – it’s true. PyTexas 2019 has challenged me to be a better person and to help people through software.

One final takeaway – another conference sticker!

Python BDD Framework Comparison

Almost every major programming language has BDD test frameworks, and Python is no exception. In fact, Python has several! So, how do they compare, and which one is best? Let’s find out.

Head-to-Head Comparison


behave is one of the most popular Python BDD frameworks. Although it is not officially part of the Cucumber project, it functions very similarly to Cucumber frameworks.


  • It fully supports the Gherkin language.
  • Environmental functions and fixtures make setup and cleanup easy.
  • It has Django and Flask integrations.
  • It is popular with Python BDD practitioners.
  • Online docs and tutorials are great.
  • It has PyCharm Professional Edition support.


  • There’s no support for parallel execution.
  • It’s a standalone framework.
  • Sharing steps between feature files can be a bit of a hassle.


pytest-bdd is a plugin for pytest that lets users write tests as Gherkin feature files rather than test functions. Because it integrates with pytest, it can work with any other pytest plugins, such as pytest-html for pretty reports and pytest-xdist for parallel testing. It also uses pytest fixtures for dependency injection.


  • It is fully compatible with pytest and major pytest plugins.
  • It benefits from pytest‘s community, growth, and goodness.
  • Fixtures are a great way to manage context between steps.
  • Tests can be filtered and executed together with other pytest tests.
  • Step definitions and hooks are easily shared using
  • Tabular data can be handled better for data-driven testing.
  • Online docs and tutorials are great.
  • It has PyCharm Professional Edition support.


  • Step definition modules must have explicit declarations for feature files (via “@scenario” or the “scenarios” function).
  • Scenario outline steps must be parsed differently.


radish is a BDD framework with a twist: it adds new syntax to the Gherkin language. Language features like scenario loops, scenario preconditions, and constants make radish‘s Gherkin variant more programmatic for test cases.




  • Gherkin language extensions empower testers to write better tests.
  • The website, docs, and logo are on point.
  • Feature files and step definitions come out very clean.


  • It’s a standalone framework with limited extensions.
  • BDD purists may not like the additions to the Gherkin syntax.


lettuce is another vegetable-themed Python BDD framework that’s been around for years. However, the website and the code haven’t been updated for a while.





  • Its code is simpler.
  • It’s tried and true.


  • It lacks the feature richness of the other frameworks.
  • It doesn’t appear to have much active, ongoing support.


freshen was one of the first BDD test frameworks for Python. It was a plugin for nose. However, both freshen and nose are no longer maintained, and their doc pages explicitly tell readers to use other frameworks.

My Recommendations

None of these frameworks are perfect, but some have clear advantages. Overall, my top recommendation is pytest-bdd because it benefits from the strengths of pytest. I believe pytest is one of the best test frameworks in any language because of its conciseness, fixtures, assertions, and plugins. The 2018 Python Developers Survey showed that pytest is, by far, the most popular Python test framework, too. Even though pytest-bdd doesn’t feel as polished as behave, I think some TLC from the open source community could fix that.

Here are other recommendations:

  • Use behave if you want a robust, clean experience with the largest community.
  • Use pytest-bdd if you need to integrate with other plugins, already have a bunch of pytest tests, or want to run tests in parallel.
  • Use radish if you want more programmatic control of testing at the Gherkin layer.
  • Don’t use lettuce or freshen.

PyCaribbean 2019 Reflections

PyCaribbean was held in Santo Domingo, Dominican Republic from February 16-17, 2019. I was blessed with the opportunity to deliver not just one talk but two at the conference! Typically, I write lengthy chronological reflections of my conference experiences, but this time, I’m going to share my big takeaways.

The welcome banner. This conference was #lit!

Python has GREAT people.

Python is truly just as much about the community as it is about the language, and conferences are one of the best ways to become part of that community. Everyone at PyCaribbean was excited to learn, grow, and be inspired. Here’s a short list of Twitter handles for some of the awesome folks who made a direct impact on me at the conference:

There were many others, too. I felt like I really got to connect with these folks, not just meet them in passing.

This was the room for my talk. Everyone was eager to learn about testing!

The Dominican Republic has GREAT people.

First of all, many thanks to Leonardo Jimenez for organizing the conference! He did so much not only to bring together an excellent program of speakers and events, but he also got the support of the local software community and even the government in the DR.

PyCaribbean really showed the best of the software world in the DR. Everyone there was hungry to learn and share. I had no idea how vibrant the software industry was becoming there, too. There’s a bright future ahead.

Don’t wait to make proposals to conferences.

I consider myself especially fortunate to have attended PyCaribbean because I almost didn’t get to go. I submitted my talk proposals one night on a whim after seeing the PyCaribbean Twitter handle appear on my feed. After submitting two talks, my third one got blocked with a message saying submissions had been closed. Had I delayed a few minutes, I would have been too late!

Join the PSF.

The Python Software Foundation (PSF) is a 501(c)(3) non-profit corporation that holds the intellectual property rights behind the Python programming language.

The PSF does awesome things for the community, such as running PyCon. Anyone can become a member, too! There are different membership classes for varying levels of involvement. Lorena Mesa, one of the PSF Directors, encouraged me to join during the conference. If you care about Python, then I encourage you to join as well!

Beach trips are fun.

The day after the conference ended, a bunch of us (mostly speakers) took a day trip to Be Live Collection Canoa at Bayahibe. This was my first time at an all-inclusive beach resort. The water was a clear light blue, and the sand was white. Mixed drinks and Presidente beers were unlimited – you could even order them from a bar in the swimming pool! The buffet lunch was also on point. Plus, the trip offered the perfect chance to get to know the others on a deeper level. I almost didn’t get to go, but thankfully Delta rearranged my flights due to weather delays and gave me an extra day in the DR. I needed that day at the beach to just be me, but relaxed. #WorthIt

Music brings people together.

One of the conference highlights was the electric violin performance on day 2. I don’t know the name of the musician, but he shredded it! He played “Wake Me Up” by Avicii, “Uptown Funk” by Bruno Mars, and “Corazon Espinado” by Santana. As I sat in the auditorium listening with the others, I just thought to myself, “This is really nice. This is a once-in-a-life performance for incredible renditions of these three awesome songs.” Everyone else there seemed to agree with me.

“Wake Me Up” (Avicii)
“Corazon Espinado” (Santana)

Passionfruit is delicious.

I ate passionfruit for the first time in my life in the DR. It was delicious. The edible flesh of the fruit is basically a gooey collection of black seeds in a yellow mucus. It tastes tart but slightly sweet. I normally don’t eat breakfast, but I devoured about four halves on the morning I first discovered them. They had them at the beach resort buffet, too!

Where has passionfruit been all my life?

I need to stick up for myself.

During my trip, it was very obvious that I was a tourist – a white American who spoke no Spanish and wandered around just to look at things. Unfortunately, because of that, some people tried to take advantage of me. I was clearly overcharged for my souvenirs, even after attempting to haggle. A guard at Independence Park took my phone to take pictures of me and then demanded money. On my return flight, a guy sat in my seat on the plane and refused to yield it to me.

These experiences really frustrated me. I’ve always been somewhat shy in social circumstances, and that leaves me vulnerable to others who would take advantage of me. Reflecting on how I handled these situations has made me determined to be more assertive. I won’t become a jerk, but I don’t need to be afraid to stick up for myself. I should use my inner strength and discernment instead of folding.

The world is a fallen place.

One thing truly broke my heart during my trip: I’m 99% sure I witnessed prostitution on multiple occasions. I won’t go into details, but it was shocking to me. Call me naïve. Let’s work to make a better world where this sort of thing doesn’t need to happen.

I know so little.

My PyCaribbean trip was challenging but rewarding. It was my first time visiting the Caribbean and Latin America. Not only did I gain some software experience, but I also gained some life experience. I’m thankful I got to go and that all the details fell perfectly into place. Hopefully, I’ll get to return to learn even more!

Time lapse while riding the JFK AirTrain

Python Testing 101: pytest-bdd

Warning: If you are new to BDD, then I strongly recommend reading the BDD 101 series before trying to use pytest-bdd. Also, make sure that you are already familiar with the pytest framework.


pytest-bdd is a behavior-driven (BDD) test framework that is very similar to behaveCucumber and SpecFlow. BDD frameworks are very different from more traditional frameworks like unittest and pytest. Test scenarios are written in Gherkin “.feature” files using plain language. Each Given, When, and Then step is “glued” to a step definition – a Python function decorated by a matching string in a step definition module. This means that there is a separation of concerns between test cases and test code. Gherkin steps may also be reused by multiple scenarios.

pytest-bdd is very similar to other Python BDD frameworks like behave, radish, and lettuce. However, unlike the others, pytest-bdd is not a standalone framework: it is a plugin for pytest. Thus, all of pytest‘s features and plugins can be used with pytest-bdd. This is a huge advantage!


Use pip to install both pytest and pytest-bdd.

pip install pytest
pip install pytest-bdd

Project Structure

Project structure for pytest-bdd is actually pretty flexible (since it is based on pytest), but the following conventions are recommended:

  • All test code should appear under a test directory named “tests”.
  • Feature files should be placed in a test subdirectory named “features”.
  • Step definition modules should be placed in a test subdirectory named “step_defs”.
  • files should be located together with step definition modules.

Other names and hierarchies may be used. For example, large test suites can have feature-specific directories of features and step defs. pytest should be able to discover tests anywhere under the test directory.

[project root directory]
|‐‐ [product code packages]
|-- [test directories]
|   |-- features
|   |   `-- *.feature
|   `-- step_defs
|       |--
|       `-- test_*.py
`-- [pytest.ini|tox.ini|setup.cfg]

Note: Step definition module names do not need to be the same as feature file names. Any step definition can be used by any feature file within the same project.

Example Code

An example project named behavior-driven-python located in GitHub shows how to write tests using pytest-bdd. This section will explain how the Web tests are designed.

The top layer for pytest-bdd tests is the set of Gherkin feature files. Notice how the scenario below is concise, focused, meaningful, and declarative:

@web @duckduckgo
Feature: DuckDuckGo Web Browsing
  As a web surfer,
  I want to find information online,
  So I can learn new things and get tasks done.

  # The "@" annotations are tags
  # One feature can have multiple scenarios
  # The lines immediately after the feature title are just comments

  Scenario: Basic DuckDuckGo Search
    Given the DuckDuckGo home page is displayed
    When the user searches for "panda"
    Then results are shown for "panda"

Each scenario step is “glued” to a decorated Python function called a step definition. Step definitions are written in Python test modules, as shown below:

import pytest

from pytest_bdd import scenarios, given, when, then, parsers
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# Constants


# Scenarios


# Fixtures

def browser():
    b = webdriver.Firefox()
    yield b

# Given Steps

@given('the DuckDuckGo home page is displayed')
def ddg_home(browser):

# When Steps

@when(parsers.parse('the user searches for "{phrase}"'))
def search_phrase(browser, phrase):
    search_input = browser.find_element_by_id('search_form_input_homepage')
    search_input.send_keys(phrase + Keys.RETURN)

# Then Steps

@then(parsers.parse('results are shown for "{phrase}"'))
def search_results(browser, phrase):
    # Check search result list
    # (A more comprehensive test would check results for matching phrases)
    # (Check the list before the search phrase for correct implicit waiting)
    links_div = browser.find_element_by_id('links')
    assert len(links_div.find_elements_by_xpath('//div')) > 0
    # Check search phrase
    search_input = browser.find_element_by_id('search_form_input')
    assert search_input.get_attribute('value') == phrase

Notice how each Given/When/Then step has a function with an appropriate decorator. Arguments, such as the search “phrase,” may also be passed from step to function. pytest-bdd provides a few argument parsers out of the box and also lets programmers implement their own. (By default, strings are compared using equality.) One function can be decorated for many steps, too.

pytest fixtures may also be used by step functions. The code above uses a fixture to initialize the Firefox WebDriver before each scenario and then quit it after each scenario. Fixtures follow all the same rules, including scope. Any step function can use a fixture by declaring it as an argument. Furthermore, any “@given” step function that returns a value can also be used as a fixture. Please read the official docs for more info about fixtures with pytest-bdd.

One important, easily-overlooked detail is that scenarios must be explicitly declared in test modules. Unlike other BDD frameworks that treat feature files as the main scripts, pytest-bdd treats the “test_*.py” module as the main scripts (because that’s what pytest does). Scenarios may be specified explicitly using scenario decorators, or all scenarios in a list of feature files may be included implicitly using the “scenarios” shortcut function shown above.

To share steps across multiple feature files, add them to the “” file instead of the test modules. Since scenarios must be declared within a test module, they can only use step functions available within the same module or in “”. As a best practice, put commonly shared steps in “” and feature-specific steps in the test module. The same recommendation also applies for hooks.

Scenario outlines require special implementation on the Python side to run successfully. Unfortunately, steps used by scenario outlines need unique step decorators and extra converting. Please read the official docs or the example project to see examples.

Test Launch

pytest-bdd can leverage the full power of pytest. Tests can be run in full or filtered by tag. Below are example commands using the example project:

# run all tests

# filter tests by test module
# note: feature files cannot be run directly
pytest tests/step_defs/
pytest tests/step_defs/
pytest tests/step_defs/
pytest tests/step_defs/

# filter tests by tags
# running by tag is typically better than running by path
pytest -k "unit"
pytest -k "service"
pytest -k "web"
pytest -k "add or remove"
pytest -k "unit and not outline"

# print JUnit report
pytest -junitxml=/path/for/output

pytest-bdd tests can be executed and filtered together with regular pytest tests. Tests can all be located within the same directory. Tags work just like pytest.mark. As a warning, marks must be explicitly added to “pytest.ini” starting with pytest 5.0.

All other pytest plugins should work, too. For example:

Pros and Cons

Just like for other BDD frameworks, pytest-bdd is best suited for black-box testing because it forces the developer to write test cases in plain, descriptive language. In my opinion, it is arguably the best BDD framework currently available for Python because it rests on the strength and extendability of pytest. It also has PyCharm support (in the Professional Edition). However, it can be more cumbersome to use than behave due to the extra code needed for declaring scenarios, implementing scenario outlines, and sharing steps. Nevertheless, I would still recommend pytest-bdd over behave for most users because it is more powerful – pytest is just awesome!

Speaking Pythonese

The Python community, like many groups, has its own language – and I don’t mean just Python. There are many words and phrases thrown around that may confuse people new to Python. I originally shared some terms in my article, Which Version of Python Should I Use?, but below are some more of those colloquialisms for quick reference:

Word or Phrase Meaning
  • Open-source implementation of Python (and R)
  • Meant for data scientists
  • Uses the conda package manager
Benevolent Dictator for Life (BDFL)
  • Guido van Rossum
  • The inventor of Python
  • Resigned in July 2018 but remains BDFL Emeritus
The CheeseShop
  • a fun code name for the Python Package Index
  • A programming definition for creating objects
  • Combines attributes (variables) and behaviors (methods)
  • Useful for reusing code
  • Package manager for Python and other languages
  • Part of the Anaconda project
Core Developer
  • A developer who has commit privilege to the CPython codebase
  • Very few Pythonistas are core developers
  • The default and most widely used implementation of the Python language
  • Implemented in C
  • A batteries-included Python Web framework for perfectionists with deadlines
  • Offers many features out of the box
  • The most popular Python framework in 2017
  • Size: Flask < Pyramid < Django
  • A microframework for Python Web development
  • Uses Werkzeug and Jinja2
  • Super-minimalist
  • Size: Flask < Pyramid < Django
  • A definition for a callable subroutine
  • May take inputs
  • May return outputs
  • Great for code reuse
  • Functions are first-order values
The Hitchhiker’s Guide to Python
  • A popular online guide to Python
  • Opinionated
  • Shares many good best practices
  • A Python template engine
  • Inspired by Django’s templates
  • A project for interactive Python development
  • “Jupyter Notebooks” allow programmers to dynamically rewrite and rerun Python code, and then share code easily with others
  • Popular with data scientists
  • A Python source code file containing definitions and statements
  • Every .py file is a module
  • May be imported by other modules to reuse code
  • A popular Python package for scientific computing
  • A popular Python package for data analysis
  • The PyPA-recommended tool for installing Python packages
  • Command: “pip install “
  • Recursive acronym for “pip installs packages”
  • A community of Pythoneers who improve their skills through code challenges
  • A popular Python IDE developed by JetBrains
  • Offers great development features
  • Has a free Community Edition and a paid Professional Edition
  • The annual Python conference held in North America
  • GO – it will change your life!
  • Several other conferences are held worldwide
  • An alternative Python implementation
  • Known for speed, memory usage, and compatibility
  • Good alternative to CPython for high performance workloads
  • A Python Web framework
  • Start small, finish big, stay finished
  • Provides many parts but not everything (such as ORM)
  • Size: Flask < Pyramid < Django
  • A lightweight-yet-powerful Python test framework (and arguably the best)
Python 2
  • The old version of Python
  • Will reach end-of-life in 2020
  • Final version will be 2.7.x
  • Please upgrade to version 3
Python 3
  • The current version of Python
  • Most packages now support Python 3
  • Has incompatibilities with Python 2
  • Please don’t use Python 2
Python Enhancement Proposal (PEP)
  • Official proposals for enhancing the Python language
Python Package Index (PyPI)
The Python Software Foundation (PSF)
  • Non-profit organization
  • Keeps Python going strong
  • Support them!
  • A programmer who uses Python to solve problems
  • Styled off the word “engineer”
  • Describes idiomatic code for Python
  • Closely related to conciseness, readability, and elegance
  • Highly recommended
  • Follow style guidelines to learn how to be Pythonic
  • Someone who loves the Python language
  • Often an advanced Python programmer
  • A popular Python tool to generate documentation
  • Tool to create isolated Python environments
  • Enables programmers to use different versions of Python and packages for different projects
  • Also see venv and pipenv
Web Server Gateway Interface (WSGI)
  • A specification for how Web servers forward requests to Web applications and frameworks
  • A core piece of Python Web development
  • See PEP-333 and PEP-3333
The Zen of Python
  • The list of guiding principles for Python’s design
  • Run “import this” to see them
  • See PEP-20

Book Review: pytest Quick Start Guide


Title pytest Quick Start Guide
(available from Packt and Amazon)
Author Bruno Oliveira (@nicoddemus)
Publication 2018 Packt Publishing
Summary “Write better Python code with simple and maintainable tests” – a very readable guide for pytest’s main features.
Prerequisites Intermediate-level Python programming.


pytest Quick Start Guide is a new book about using pytest for Python test automation. Bruno Oliveira explains not only how to use pytest but also why its features are useful. Even though this book is written as a “quick start” introduction, it nevertheless dives deep into pytest’s major features. It covers:

  1. An introduction to pytest
  2. Why pytest is superior to unittest
  3. Setting up pytest with pip and virtualenv
  4. Writing basic tests
  5. How assertions really work
  6. Common command line arguments
  7. Marks and parametrization
  8. Using and writing fixtures
  9. Popular plugins
  10. Converting unittest suites to pytest

Example code is hosted on GitHub at PacktPublishing/pytest-Quick-Start-Guide.


This book is an easy introduction to test automation in Python with pytest. Readers should have intermediate-level Python skills, but they do not need previous testing or automation skills. The progression of chapters makes it easy to start quick and then go deeper. Oliveira has a very accessible writing style, too.

The unittest refactoring guide is a hidden gem. The unittest module is great because it comes bundled with Python, but it is also clunky and not very Pythonic. Not all teams know the best way to modernize their test suites. Oliveira provides many pieces of practical advice for making the change, at varying degrees of conversion. The big changes use pytest’s fixtures and assertions.

A Comparison to Python Testing with pytest

Python Testing with pytest by Brian Okken is another popular pytest book. Both books are great resources for learning pytest, but each approaches the framework from a unique perspective. How do they compare? Here’s what I saw:

Oliveira’s book Okken’s book
Oliveira’s book is a great introductory guide for pytest. Oliveira’s writing style makes the reader feel like the author is almost teaching in person. The book’s main theme is getting the reader to use the main features of pytest pragmatically for general testing needs. The main differences in content are the unittest refactoring guide and some of the plugins and fixtures covered. This book is probably the best choice for beginners who want to learn the basics of pytest quickly. Okken’s book is introductory but also a great manual for future reference. Okken’s writing style is direct and concise, which covers more material in fewer pages. The format for each chapter is consistent: for each idea: idea → code → output → explanation; exercises at the end. Okken also covers how to create and share custom pytest plugins. This book is probably the best choice for people who want to master the ins and outs of pytest.

Ultimately, I recommend both books because they are both excellent.


Reading books on the same subject by different authors helps the reader learn the subject better. I’ve used pytest quite a lot myself, but I was able to learn new things from both pytest Quick Start Guide and Python Testing with pytest. Reading how experts use and think about the framework makes me a better engineer. Different writing styles and different opinions also challenge my own understandings. (It’s also funny that the authors of both pytest books have the same initials – “B.O.”)

pytest is really popular. There are now multiple good books on the subject. It’s becoming the de facto test automation framework for Python, outpacing unittest, nose, and others. These days, it seems more popular to write a pytest plugin than to create a new framework.