Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the way fixtures are injected into tests and convert related tests to class based tests. #52

Open
Tomasz-Kluczkowski opened this issue Dec 1, 2018 · 0 comments

Comments

@Tomasz-Kluczkowski
Copy link
Owner

Tomasz-Kluczkowski commented Dec 1, 2018

  • Convert all related tests into class based tests with appropriate names.
  • use the example below to inject required fixtures per class. Remember that this will redo all injected fixutres per each test in a class. If a fixture is needed for only one test among many in the class test do not inject it in the decorator but normally at method level.
    This is to avoid specifying fixture in each method separately as it is now.
@pytest.mark.usefixtures("cleandir")
class TestDirectoryInit(object):
    def test_cwd_starts_empty(self):
        assert os.listdir(os.getcwd()) == []
        with open("myfile", "w") as f:
            f.write("hello")

    def test_cwd_again_starts_empty(self):
        assert os.listdir(os.getcwd()) == []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant