Last active
February 13, 2018 17:52
-
-
Save aychedee/6021e7f41a383ec82f142d0934cbcdc9 to your computer and use it in GitHub Desktop.
Fast and slow tests using pytest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytest | |
import requests | |
def my_fast_func(x, y): | |
return x * y | |
@pytest.mark.slow | |
def test_talk_to_network(): | |
assert requests.get('https://example.com').status_code == 200 | |
def test_a_discrete_function(): | |
assert my_fast_func(2, 4) == 8 | |
# Then you can run only your fast tests with: | |
# pytest -v -m "not slow" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment