anki/pylib/tests/run_pytest.py
Damien Elmes 97300a16bf implement fuzzing
Notes:

- The fuzz seed is now derived from the card id and # of reps, so
if a card is undone and done again, the same fuzz will be used.
- The intervals shown on the answer buttons now include the fuzz, instead
of hiding it from the user. This will prevent questions about due dates
being different to what was shown on the buttons, but will create
questions about due dates being different for cards with the same
interval, and some people may find it distracting for learning cards.
The new approach is easier to reason about, but time will tell
whether it's a net gain or not.
- The env var we were using to shift the clock away from rollover for
unit tests has been repurposed to also disable fuzzing, which simplifies
the tests.
- Cards in filtered decks without scheduling now have the preview delay
fuzzed.
- Sub-day learning cards are mostly fuzzed like before, but will apply
the up-to-5-minutes of fuzz regardless of the time of day.
- The answer buttons now round minute values, as the fuzz on short
intervals is distracting.
2021-02-22 21:31:53 +10:00

16 lines
440 B
Python

import os
import sys
import pytest
os.environ["ANKI_TEST_MODE"] = "1"
if __name__ == "__main__":
folder = os.path.join(os.path.dirname(__file__), "..", "tests")
args = ["--verbose", "-s", folder]
# allow specifying an individual test, eg
# bazel test //pylib:pytest --test_env=PYTEST=test_bury
if pytest_extra := os.environ.get("PYTEST", ""):
args.extend(["-k", pytest_extra])
sys.exit(pytest.main(args))