Reputation: 123
I'd like to know how pytest runs test files it finds in a package, so i know what information is available (__name__, __package__, etc) when i try to import modules from the test files.
I tried to take a look at pytest's sources, but they are way too big for a search to be worth it and googling around didn't yield much, so hopefully someone here knows this !
thanks
Upvotes: 0
Views: 191
Reputation: 771
I would say it depends, in a simple case you are responsible to import the module under test, so you then use the module class/methods or function you want to test in your tests. So pytest execute the test_ files and the imported modules as any python module I would say...
You have example in this get started : https://docs.pytest.org/en/latest/getting-started.html
In a more complexe case, let say, test a webapp, you will need to run the webapp environnement then use selenium for example to browse the app and write tests cases...
But I am not sure I answer your question...
Upvotes: 1