Skip to content

Commit ba4797c

Browse files
committed
Skip VCR.py related tests if VCRPY_ENCRYPTION_KEY is not available.
This is a temporary solution for #37
1 parent 2de7e52 commit ba4797c

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

tests/pymonzo/test_accounts.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Test `pymonzo.accounts` module."""
22

3+
import os
4+
35
import pytest
46
from polyfactory.factories.pydantic_factory import ModelFactory
57
from pytest_mock import MockerFixture
@@ -101,6 +103,10 @@ def test_get_default_account(
101103
mocked_accounts_list.reset_mock()
102104

103105
@pytest.mark.vcr()
106+
@pytest.mark.skipif(
107+
os.getenv("VCRPY_ENCRYPTION_KEY") is None,
108+
reason="`VCRPY_ENCRYPTION_KEY` is not available on GitHub PRs.",
109+
)
104110
def test_list_vcr(
105111
self,
106112
mocker: MockerFixture,

tests/pymonzo/test_balance.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Test `pymonzo.balance` module."""
22

3+
import os
4+
35
import httpx
46
import pytest
57
import respx
@@ -86,6 +88,10 @@ def test_list_respx(
8688
assert mocked_route.called
8789

8890
@pytest.mark.vcr()
91+
@pytest.mark.skipif(
92+
os.getenv("VCRPY_ENCRYPTION_KEY") is None,
93+
reason="`VCRPY_ENCRYPTION_KEY` is not available on GitHub PRs.",
94+
)
8995
def test_list_vcr(self, balance_resource: BalanceResource) -> None:
9096
"""API response is parsed into expected schema."""
9197
balance = balance_resource.get()

tests/pymonzo/test_pots.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Test `pymonzo.pots` module."""
22

3+
import os
4+
35
import httpx
46
import pytest
57
import respx
@@ -131,6 +133,10 @@ def test_get_default_pot(
131133
mocked_pots_list.reset_mock()
132134

133135
@pytest.mark.vcr()
136+
@pytest.mark.skipif(
137+
os.getenv("VCRPY_ENCRYPTION_KEY") is None,
138+
reason="`VCRPY_ENCRYPTION_KEY` is not available on GitHub PRs.",
139+
)
134140
def test_list_vcr(self, pots_resource: PotsResource) -> None:
135141
"""API response is parsed into expected schema."""
136142
pots_list = pots_resource.list()

tests/pymonzo/test_whoami.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
"""Test `pymonzo.whoami` module."""
22

3+
import os
4+
35
import pytest
46

57
from pymonzo import MonzoAPI
@@ -16,6 +18,10 @@ class TestWhoAmIResource:
1618
"""Test `WhoAmIResource` class."""
1719

1820
@pytest.mark.vcr()
21+
@pytest.mark.skipif(
22+
os.getenv("VCRPY_ENCRYPTION_KEY") is None,
23+
reason="`VCRPY_ENCRYPTION_KEY` is not available on GitHub PRs.",
24+
)
1925
def test_whoami_vcr(self, whoami_resource: WhoAmIResource) -> None:
2026
"""API response is parsed into expected schema."""
2127
whoami = whoami_resource.whoami()

0 commit comments

Comments
 (0)