ASPP / pelita_template

Default template to get started with the Pelita game.
3 stars 25 forks source link

.env file that sets up the PYTHONPATH for tests from inside VSCode #48

Closed Debilski closed 3 years ago

Debilski commented 3 years ago

As the pelita_template folder isn’t a proper package, pytest can only run the tests when invoked as python -m pytest, as this adds the template folder to sys.path. Unfortunately, the VSCode mechanism for invoking pytest runs it as a script and therefore our tests cannot import the demoXX.py files.

This .env file should automatically be read by VSCode (and perhaps other tools) and add the current folder to the PYTHONPATH (yeah, I also thought these days would be over).

Now running (or debugging!) tests is as simple as clicking the Run test! button above a function inside the editor window and waiting for the check mark to appear.

image