Skip to content

Instantly share code, notes, and snippets.

@ionelmc
Created January 12, 2015 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ionelmc/d482203a2eea760301f8 to your computer and use it in GitHub Desktop.
Save ionelmc/d482203a2eea760301f8 to your computer and use it in GitHub Desktop.
Pytest fixture linting
# This should not emit any complaints
import pytest
class App:
def __init__(self, smtp):
self.smtp = smtp
@pytest.fixture(scope="module")
def app(smtp):
return App(smtp)
def test_smtp_exists(aap): # Ooooops. TYPO!
assert app.smtp # This will fail with horribly contrived error
# This should not emit any complaints
import pytest
class App:
def __init__(self, smtp):
self.smtp = smtp
@pytest.fixture(scope="module")
def app(smtp):
return App(smtp)
def test_smtp_exists(app):
assert app.smtp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment