DiscoverTest & Code221: How to get pytest to import your code under test
221: How to get pytest to import your code under test

221: How to get pytest to import your code under test

Update: 2024-06-03
Share

Description

We've got some code we want to test, and some tests.
The tests need to be able to import the code under test, or at least the API to it, in order to run tests against it.
How do we do that? How do we set things up so that our tests can import our code?

In this episode, we discuss two options:

  • Installing the code under test as a pip installable package with `pip install -e /path/to/local/package`.
  • Using the pythonpath pytest setting.


 Learn pytest

Comments 
00:00
00:00
x

0.5x

0.8x

1.0x

1.25x

1.5x

2.0x

3.0x

Sleep Timer

Off

End of Episode

5 Minutes

10 Minutes

15 Minutes

30 Minutes

45 Minutes

60 Minutes

120 Minutes

221: How to get pytest to import your code under test

221: How to get pytest to import your code under test

Brian Okken