fgebhart / workoutizer

:weight_lifting: Browser based Sport and Workout Organizer :running_woman:
MIT License
62 stars 11 forks source link

TST: Test results not consistent #177

Closed gotiniens closed 3 years ago

gotiniens commented 3 years ago

Describe the bug After merging #174 running the tests/db_tests/test_api.py::test_mount_device__success test does not produce consistent results. When running the tests with the -n 1 parameter the tests fail, the tests suceed when running with -n 2 or an higher number of threads.

To Reproduce Steps to reproduce the behavior:

  1. start docker container with ./run_docker.sh
  2. Start test with pytest tests/db_tests/test_api.py -n 2 --no-header -v
  3. see All tests succeed
  4. start tests with pytest tests/db_tests/test_api.py -n 1 --no-header -v
  5. See the tests/db_tests/test_api.py::test_mount_device__success test fail

Aditionall context The problem is two-fold:

  1. The code intruduced with #174 was not tested correctly, so I changed the test to account for the new _find_device_type function. You can find the PR for this in #176. I consider this fixed with that PR.
  2. The real problem is that this issue was not identified by the automatic tests. I have no clue why. A solution would be running the tests with 1 thread and with multiple threads, but that would still be an workaround imho.