Skip to content

Instantly share code, notes, and snippets.

@garrettr
Created August 16, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garrettr/712282c8f513ec99a5c271d3bc79e971 to your computer and use it in GitHub Desktop.
Save garrettr/712282c8f513ec99a5c271d3bc79e971 to your computer and use it in GitHub Desktop.
Running specific unit tests in SecureDrop 0.3.x

You need to recreate the environment and run a test rqworker, as is done in manage.py test.

The important thing to remember is that the rqworker needs to run with SECUREDROP_ENV=test because it loads the config and runs some Python code independently of the test runner.

My preferred way to do this is:

vagrant up development
vagrant ssh
tmux # so you can monitor the output of rqworker for errors. You could also run it in the background.
# Split your tmux panes
# In Pane 1, run the "test" rqworker.
SECUREDROP_ENV=test rqworker test -P /vagrant/securedrop/
# In Pane 2, run py.test. You can now pass any flags you want to py.test to take advantage of all of its sweet features.
SECUREDROP_ENV=test py.test -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment