Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Bug: Tests don't all work in isolation #53

Closed
CosmicHorrorDev opened this issue Jun 6, 2020 · 2 comments
Closed

Bug: Tests don't all work in isolation #53

CosmicHorrorDev opened this issue Jun 6, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@CosmicHorrorDev
Copy link
Owner

Bug Report

  • subwinder version: master
  • OS name and version: NA

Description

The tests currently don't work in isolation. This is due to language list caching which isn't followed through for all tests in the same manner, because of this some tests depend on earlier tests faking the language list. Setting up an autouse fixture might help here for the default and then have another to disable the language list cache since that is the least common case.

Code to reproduce

@CosmicHorrorDev CosmicHorrorDev added the bug Something isn't working label Jun 6, 2020
@CosmicHorrorDev CosmicHorrorDev added this to the Version 1.2.0 milestone Jun 6, 2020
@CosmicHorrorDev
Copy link
Owner Author

Some things to improve this situation:

  • Add a fixture to clear relevant env vars before each test run
  • Add a fixture for faking an AuthSubwinder instance
  • Test io for the examples
  • Move faking media to a fixture? Can do it once and then verify that the files are still there after each run (can we do multiple yields in a single fixture for multiple calls? If not then just check the cached location)
  • Is there a way we can make sure no requests go to the api durring unit tests? Some suite wide fixture with a mock that will raise an exception?

@CosmicHorrorDev
Copy link
Owner Author

This should be working now. The process involved using fixtures for faking a lang cache as well as ensuring that env vars that can impact the tests were cleared before each test ran. To ensure that this continues working I'm using a pytest plugin that randomizes the order that the tests get evaluated in.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant