From 765db0fc8149aad4c103244e013fdd128af8d3d2 Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 27 Nov 2017 04:22:03 +0100 Subject: move fixtures.py to standardized location conftest.py --- tests/conftest.py | 24 ++++++++++++++++++++++++ tests/fixtures.py | 25 ------------------------- tests/test_hooks.py | 2 +- tests/test_instance.py | 1 - 4 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 tests/conftest.py delete mode 100644 tests/fixtures.py diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..1858ab8 --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,24 @@ +import pytest + +@pytest.fixture +def mastodon(): + import mastodon as _mastodon + return _mastodon.Mastodon( + api_base_url='http://localhost:3000', + client_id='__MASTODON_PY_TEST_ID', + client_secret='__MASTODON_PY_TEST_SECRET', + access_token='__MASTODON_PY_TEST_TOKEN') + +@pytest.fixture() +def status(mastodon): + _status = mastodon.status_post('Toot!') + yield _status + mastodon.status_delete(_status['id']) + + +@pytest.fixture() +def vcr_config(): + return dict( + match_on = ['method', 'path', 'query', 'body'], + decode_compressed_response = True + ) diff --git a/tests/fixtures.py b/tests/fixtures.py deleted file mode 100644 index 1b32866..0000000 --- a/tests/fixtures.py +++ /dev/null @@ -1,25 +0,0 @@ -import pytest - -@pytest.fixture -def mastodon(): - import mastodon as _mastodon - return _mastodon.Mastodon( - api_base_url='http://localhost:3000', - client_id='__MASTODON_PY_TEST_ID', - client_secret='__MASTODON_PY_TEST_SECRET', - access_token='__MASTODON_PY_TEST_TOKEN') - - - -@pytest.fixture() -def status(mastodon): - _status = mastodon.status_post('Toot!') - yield _status - mastodon.status_delete(_status['id']) - -@pytest.fixture() -def vcr_config(): - return dict( - match_on = ['method', 'path', 'query', 'body'], - decode_compressed_response = True - ) diff --git a/tests/test_hooks.py b/tests/test_hooks.py index fe242a6..132021b 100644 --- a/tests/test_hooks.py +++ b/tests/test_hooks.py @@ -1,4 +1,4 @@ -from .fixtures import * +import pytest from datetime import datetime @pytest.mark.vcr() diff --git a/tests/test_instance.py b/tests/test_instance.py index d6f1bed..3ea3cf1 100644 --- a/tests/test_instance.py +++ b/tests/test_instance.py @@ -1,4 +1,3 @@ -from .fixtures import * import pytest @pytest.mark.vcr() -- cgit v1.2.3