ElectionDataAnalysis / electiondata

Tools for consolidation and analysis of raw election results from the most reliable sources -- the election agencies themselves.
Other
20 stars 5 forks source link

De-pythonize test-writing process for specific election-jurisdiction pairs #699

Closed sfsinger19103 closed 3 years ago

sfsinger19103 commented 3 years ago

Currently a person wanting to test a set of results for a single election-jurisdiction pair has to edit a python file test_<juris>_<election>.py. Instead, user should be required only to put info into a tab-separated text file of a specified form.

sfsinger19103 commented 3 years ago

See https://docs.pytest.org/en/latest/how-to/usage.html#calling-pytest-from-python-code

Calling pytest from Python code You can invoke pytest from Python code directly:

retcode = pytest.main() this acts as if you would call “pytest” from the command line. It will not raise SystemExit but return the exit code instead. You can pass in options and arguments:

retcode = pytest.main(["-x", "mytestdir"])

sfsinger19103 commented 3 years ago

Ideally, would look up jurisdiction id and election id only once during a testing session.