Skip to content

Instantly share code, notes, and snippets.

@vladak
Last active January 31, 2020 14:48
Show Gist options
  • Save vladak/7bf0d5ef9e2a05e769e09d0ecd50e6aa to your computer and use it in GitHub Desktop.
Save vladak/7bf0d5ef9e2a05e769e09d0ecd50e6aa to your computer and use it in GitHub Desktop.
pytest woes

pytest woes

These problems were encountered during OpenGrok development however most likely they are generic.

setup.py

Initial setup:

python3 -m venv env
. env/bin/activate
python -m pip install -r requirements.txt
python setup.py develop

Even after this it is necessary to do python setup.py install whenever code under src/main changes.

Another problem is that when pytest is run directly, the requisites (under tests_require) from setup.py are not available. For instance I had to install mockito, pytest-xdist etc.

single test

pytest -k test_get_repos_for_project

pdb

When pdb breakpoint is enabled in code like so:

import pdb
pdb.set_trace()

it is necessary to run pytest with --pdb so that pdb can be interacted with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment