Page MenuHomePhabricator

Pywikibot pytest should be ready to use
Open, MediumPublicFeature


I am currently attempting to get more tests to run with pytest and think we need to make it more convenient to use pytest. Ideally all tests should run after cloning the repository without any further setup.

By default most tests will skip because they involve editing So instead of just typing

$ pytest tests/

the user needs to pass the correct environment variable:

$ ENV_NAME='testing' PYWIKIBOT2_TEST_WRITE=1 python3 -m pytest tests/

But even then the tests run painfully slow, because the bot will use the sleep times in the user-config instead of using lower sleep-times for testing. So it would also be good to make separate settings when running tests (Setting minthrottle = 0, maxthrottle = 1 in the user-config made the tests run in a reasonable time).

For those people that would like to help with the pytest compatibility, just choose a group of tests and run:

$ ENV_NAME='testing' PYWIKIBOT2_TEST_WRITE=1 python3 -m pytest tests/ -rxs --maxfail=1

Event Timeline

We have at least one customised config variables for the tests, set in tests/ . Setting throttles in there would also be useful.

More documentation in tests/README.rst very welcome..

what is ENV_NAME='testing' ?

Dvorapa triaged this task as Medium priority.Apr 3 2020, 4:36 PM
Dvorapa changed the subtype of this task from "Task" to "Feature Request".

This seems like a good idea. We use some configuration options in both .travis.yml and .appveyor.yml. These should be moved to tests module directly