Test and Code: 87: Paths to Parametrization – from one test to many

There’s a cool feature of pytest called parametrization.
It’s totally one of the superpowers of pytest.

It’s actually a handful of features, and there are a few ways to approach it.
Parametrization is the ability to take one test, and send lots of different input datasets into the code under test, and maybe even have different output checks, all within the same test that you developed in the simple test case.

Super powerful, but something since there’s a few approaches to it, a tad tricky to get the hang of.

Sponsored By:

Support Test & Code – Python Testing & Development

Links:

<p>There&#39;s a cool feature of pytest called parametrization.<br> It&#39;s totally one of the superpowers of pytest.</p> <p>It&#39;s actually a handful of features, and there are a few ways to approach it.<br> Parametrization is the ability to take one test, and send lots of different input datasets into the code under test, and maybe even have different output checks, all within the same test that you developed in the simple test case.</p> <p>Super powerful, but something since there&#39;s a few approaches to it, a tad tricky to get the hang of.</p><p>Sponsored By:</p><ul><li><a href=”https://testandcode.com/pycharm” rel=”nofollow”>PyCharm Professional</a>: <a href=”https://testandcode.com/pycharm” rel=”nofollow”>Try PyCharm Pro for 4 months. Offer good through June 10. Try out Pro features like integrated coverage and profiling, and extended support for Django, Flask, Pyramid, Cython, and more.</a> Promo Code: TESTNCODE2019</li></ul><p><a href=”https://www.patreon.com/testpodcast” rel=”payment”>Support Test & Code – Python Testing & Development</a></p><p>Links:</p><ul><li><a href=”https://docs.pytest.org/en/latest/changelog.html” title=”pytest changelog” rel=”nofollow”>pytest changelog</a></li><li><a href=”https://docs.pytest.org/en/latest/deprecations.html#deprecations” title=”pytest deprecations and removals” rel=”nofollow”>pytest deprecations and removals</a></li><li><a href=”https://pragprog.com/book/bopytest/python-testing-with-pytest” title=”Python Testing with pytest” rel=”nofollow”>Python Testing with pytest</a> &mdash; Test function parametrization is in chapter 2. Fixture parametrization is in chapter 3.</li><li><a href=”https://docs.pytest.org/en/latest/parametrize.html” title=”Parametrizing test functions — pytest documentation” rel=”nofollow”>Parametrizing test functions — pytest documentation</a></li><li><a href=”https://docs.pytest.org/en/latest/fixture.html#fixture-parametrize” title=”pytest fixtures — pytest documentation” rel=”nofollow”>pytest fixtures — pytest documentation</a></li></ul>
Planet Python

Test and Code: 86: Teaching testing best practices with 4 testing maxims – Josh Peak

You’ve incorporated software testing into your coding practices and know from experience that it helps you get your stuff done faster with less headache.

Awesome.

Now your colleagues want in on that super power and want to learn testing.

How do you help them?

That’s where Josh Peak is. He’s helping his team add testing to their workflow to boost their productivity.

That’s what we’re talking about today on Test & Code.

Josh walks us through 4 maxims of developing software tests that help grow your confidence and proficiency at test writing.

Special Guest: Josh Peak.

Sponsored By:

Support Test & Code – Python Testing & Development

Links:

<p>You&#39;ve incorporated software testing into your coding practices and know from experience that it helps you get your stuff done faster with less headache.</p> <p>Awesome.</p> <p>Now your colleagues want in on that super power and want to learn testing.</p> <p>How do you help them? </p> <p>That&#39;s where Josh Peak is. He&#39;s helping his team add testing to their workflow to boost their productivity. </p> <p>That&#39;s what we&#39;re talking about today on Test &amp; Code.</p> <p>Josh walks us through 4 maxims of developing software tests that help grow your confidence and proficiency at test writing.</p><p>Special Guest: Josh Peak.</p><p>Sponsored By:</p><ul><li><a href=”https://raygun.com” rel=”nofollow”>Raygun</a>: <a href=”https://raygun.com” rel=”nofollow”>Detect, diagnose, and destroy Python errors that are affecting your customers. With smart Python error monitoring software from Raygun, you can be alerted to issues affecting your users the second they happen.</a></li></ul><p><a href=”https://www.patreon.com/testpodcast” rel=”payment”>Support Test & Code – Python Testing & Development</a></p><p>Links:</p><ul><li><a href=”https://joshpeak.net/posts/2019-07-22-from-zero-to-test.html” title=”From Zero to Test: Turning hurdles into steps. ” rel=”nofollow”>From Zero to Test: Turning hurdles into steps. </a></li><li><a href=”https://joshpeak.net/posts/2019-06-18-Advanced-python-testing.html” title=”Advanced Python Testing” rel=”nofollow”>Advanced Python Testing</a> &mdash; Posts</li><li><a href=”https://pypi.org/project/pytest-vcr/” title=”pytest-vcr” rel=”nofollow”>pytest-vcr</a></li><li><a href=”https://vcrpy.readthedocs.io/en/latest/” title=”VCR.py” rel=”nofollow”>VCR.py</a></li><li><a href=”https://pypi.org/project/pytest-randomly/” title=”pytest-randomly” rel=”nofollow”>pytest-randomly</a></li></ul>
Planet Python

Python Engineering at Microsoft: Python in Visual Studio Code – September 2019 Release

We are pleased to announce that the September 2019 release of the Python Extension for Visual Studio Code is now available. You can download the Python extensionfrom the Marketplace, or install it directly from the extension gallery in Visual Studio Code. If you already have the Python extension installed, you can also get the latest update by restarting Visual Studio Code. You can learn more about  Python support in Visual Studio Code in the documentation.  

This was a short release where we closed 35 issues, including improvements to the Python Language Server and to Jupyter Notebook cell debugging, as well as detection of virtual environment creationThe full list of enhancements is listed in ourchangelog. 

Improvements to Python Language Server 

The Python Language Server now has linting capabilities, and its latest release includenew linting messages and variety of additional general improvements, which are listed in the section “Other changes and enhancements” below  

The linting messages provided by the Python Language Server include detecting unresolved imports, undefined variables, too many arguments in a function call, unknown keyword arguments and inheriting from something that is not a class. To see the full detailed list of linting messages, you can check the documentation in the Language Server GitHub repo or the settings reference page within the Python for Visual Studio Code docs. 

We’ve also added general #noqa support, slinting messages can be disabled on a case by case basis. Lines with a #noqa comment will have their diagnostic output suppressed. For more information, you can check thdocumentation. 

Improvements to Jupyter Notebook cell debugging  

In the August release, we added the ability to debug Jupyter notebook cells where you can step into user code. In this release, this feature is enhanced with the option to also step into non-user code if needed. To enable, open the settings page (File > Preferences > Settings), search for “Data Science: Debug Just My Code” and uncheck the option. 

Once the setting is disabled, you’ll be able to step into function calls and, for example, inspect the non-user code behavior and how variables change when it’s being executed.  

Detection of virtual environment creation  

The Python interpreter displayed on the status bar indicates which environment the Python extension is using for running Python code (using the Python: Run Python File in Terminal command, for example), and to provide language services such as auto-completion, syntax checking, linting, formatting, etc:

In this release, when a new virtual environment is created, prompt will be displayed asking if you’d like to select its interpreter for the workspace 

This will add the path to the Python interpreter from the new virtual environment to your workspace settingsand therefore that environment will be used when installing packages and running code through the Python extension.  

Other Changes and Enhancements 

We have also added small enhancements and fixed issues requested by users that should improve your experience working with Python in Visual Studio Code. Some notable changes include: 

  • Update Jedi to 0.15.1 and parso to 0.5.1. (#6294) 
  • Bump version of PTVSD to 4.3.2. 
  • Added a setting to allow Python code to be executed when the interactive window is loading. (#6842) 
  • Add debug command code lenses when in debug mode. (#6672) 
  • General Improvements for the Python Language Server: 
    • Improved handling of generic classes in inheritance chains (#1278) 
    • Added support for TypeVar bound and generic self (#1242) 
    • Added support for forward references in type strings (#1186) 
    • Added goto definition for members in class bases (#1356#1443) 
    • Improved assignment handling (#1457#1494#411#1382 

We are continuing to A/B test new features. If you see something different that was not announced by the team, you may be part of an experiment! To see if you are part of an experiment, you can check the first lines in the Python extension output channel. If you wish to opt-out from A/B testing, disable telemetry in Visual Studio Code.  

Be sure to download the Python extension for Visual Studio Code now to try out the above improvements. If you run into any problems, please file an issue on the Python VS Code GitHub page. 

The post Python in Visual Studio Code – September 2019 Release appeared first on Python.

Planet Python

Test and Code: 84: CircuitPython – Scott Shawcroft

Adafruit enables beginners to make amazing hardware/software projects.
With CircuitPython, these projects can now use Python.

The combination of Python’s ease of use and Adafruit’s super cool hardware and a focus on a successful beginner experience makes learning to write code that controls hardware super fun.

In this episode, Scott Shawcroft, the project lead, talks about the past, present, and future of CircuitPython, and discusses the focus on the beginner.

We also discuss contributing to the project, testing CircuitPython, and many of the cool projects and hardware boards that can use CircuitPython, and Blinka, a library to allow you to use "CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython," including Raspberry Pi.

Special Guest: Scott Shawcroft.

Sponsored By:

Links:

<p>Adafruit enables beginners to make amazing hardware/software projects.<br> With CircuitPython, these projects can now use Python.</p> <p>The combination of Python&#39;s ease of use and Adafruit&#39;s super cool hardware and a focus on a successful beginner experience makes learning to write code that controls hardware super fun.</p> <p>In this episode, Scott Shawcroft, the project lead, talks about the past, present, and future of CircuitPython, and discusses the focus on the beginner.</p> <p>We also discuss contributing to the project, testing CircuitPython, and many of the cool projects and hardware boards that can use CircuitPython, and Blinka, a library to allow you to use &quot;CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython,&quot; including Raspberry Pi.</p><p>Special Guest: Scott Shawcroft.</p><p>Sponsored By:</p><ul><li><a href=”https://www.patreon.com/testpodcast” rel=”nofollow”>Patreon Supporters</a>: <a href=”https://www.patreon.com/testpodcast” rel=”nofollow”>Help support the show with as little as $ 1 per month and be the first to know when new episodes come out.</a></li></ul><p>Links:</p><ul><li><a href=”https://circuitpython.org/” title=”CircuitPython” rel=”nofollow”>CircuitPython</a></li><li><a href=”https://circuitpython.org/downloads” title=”Downloads” rel=”nofollow”>Downloads</a> &mdash; All the products that run CircuitPython</li><li><a href=”https://learn.adafruit.com/category/circuitpython” title=”Learning Guides with CircuitPython” rel=”nofollow”>Learning Guides with CircuitPython</a></li><li><a href=”https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart” title=”Loading CircuitPython on Circuit Playground Express” rel=”nofollow”>Loading CircuitPython on Circuit Playground Express</a></li><li><a href=”https://adafru.it/discord” title=”Adafruit Discord Server” rel=”nofollow”>Adafruit Discord Server</a></li><li><a href=”https://twitter.com/tannewt” title=”Scott Shawcroft (@tannewt) / Twitter” rel=”nofollow”>Scott Shawcroft (@tannewt) / Twitter</a></li><li><a href=”https://pypi.org/project/Adafruit-Blinka/” title=”Adafruit-Blinka ” rel=”nofollow”>Adafruit-Blinka </a></li></ul>
Planet Python

Test and Code: 83: PyBites Code Challenges behind the scenes – Bob Belderbos

Bob Belderbos and Julian Sequeira started PyBites a few years ago.
They started doing code challanges along with people around the world and writing about it.

Then came the codechalleng.es platform, where you can do code challenges in the browser and have your answer checked by pytest tests. But how does it all work?

Bob joins me today to go behind the scenes and share the tech stack running the PyBites Code Challenges platform.

We talk about the technology, the testing, and how it went from a cool idea to a working platform.

Special Guest: Bob Belderbos.

Sponsored By:

Support Test & Code – Python Testing & Development

Links:

<p>Bob Belderbos and Julian Sequeira started <a href=”https://pybit.es/” rel=”nofollow”>PyBites</a> a few years ago.<br> They started doing code challanges along with people around the world and writing about it. </p> <p>Then came the <a href=”https://codechalleng.es/” rel=”nofollow”>codechalleng.es</a> platform, where you can do code challenges in the browser and have your answer checked by pytest tests. But how does it all work?</p> <p>Bob joins me today to go behind the scenes and share the tech stack running the PyBites Code Challenges platform.</p> <p>We talk about the technology, the testing, and how it went from a cool idea to a working platform.</p><p>Special Guest: Bob Belderbos.</p><p>Sponsored By:</p><ul><li><a href=”https://testandcode.com/pycharm” rel=”nofollow”>PyCharm Professional</a>: <a href=”https://testandcode.com/pycharm” rel=”nofollow”>PyCharm is designed by programmers, for programmers, to provide all the tools you need for productive Python development.</a></li></ul><p><a href=”https://www.patreon.com/testpodcast” rel=”payment”>Support Test & Code – Python Testing & Development</a></p><p>Links:</p><ul><li><a href=”https://pybit.es/” title=”PyBites” rel=”nofollow”>PyBites</a></li><li><a href=”https://codechalleng.es/” title=”PyBites Code Challenges coding platform” rel=”nofollow”>PyBites Code Challenges coding platform</a></li><li><a href=”https://codechalleng.es/bites/paths” title=”Learning Paths” rel=”nofollow”>Learning Paths</a></li><li><a href=”https://pybit.es/whiteboard-interviews.html” title=”Julian’s article on whiteboard interviews” rel=”nofollow”>Julian’s article on whiteboard interviews</a></li></ul>
Planet Python