
Test & Code
221: How to get pytest to import your code under test
Jun 3, 2024
Exploring how to make pytest import your code under test including options like installing code with pip install -e /path/to/local/package and using the pythonpath pytest setting. Discussing the challenges of importing code for pytest and the benefits of packaging for distribution. Learning how to set the Python path in PyTest configuration files for code import.
08:18
AI Summary
AI Chapters
Episode notes
Podcast summary created with Snipd AI
Quick takeaways
- Setting up Python path in pytest settings is crucial for successful code import in testing.
- Install the code under test as a pip installable package to allow test code import.
Deep dives
Importing Code Under Test
In this podcast episode, the focus is on importing the code under test for testing purposes. The host explains the importance of setting up the testing environment correctly so that tests can access the code under test. Whether it's a single Python file, a module with functions, or a directory package, the challenge lies in allowing the test code to import the necessary components.
Remember Everything You Learn from Podcasts
Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.