How does one run tests on openstates.org?


#1

I can’t figure out how to run tests.

For example,
./manage.py test

logs:

Creating test database for alias 'default'...
System check identified no issues (0 silenced).

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
Destroying test database for alias 'default'...

Also,

pytest

logs (in part):

../../../.local/share/virtualenvs/openstates.org-WfooTdlV/lib/python3.7/site-packages/django/apps/registry.py:127: in check_apps_ready
    raise AppRegistryNotReady("Apps aren't loaded yet.")
E   django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.

#2

They’re a bit more complex because of the database requirement and all.

https://github.com/openstates/openstates.org/blob/develop/.travis.yml Has all of the steps. Once you actually have things set up the line to run is

poetry run pytest --ds=openstates.test_settings --reuse-db -v geo graphapi public v1 utils


#3

This would be a great thing to dockerize if anyone is so inclined :smiley: The existing dockerfile/docker-compose aren’t correct and could be rewritten


#4

I thought that there is no test suite, as a matter of policy/design.


#5

there are a ton of tests for the actual site/frameworks/tools, the scrapers however are designed under the “break on unexpected data” principle as you allude to