Skip to content

Commit

Permalink
fix marker fixtures to autouse; set filterwarning in pytest config
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Dec 8, 2023
1 parent 4b3cb6d commit 06b398f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,6 @@ markers = [
"only_for_token_types: running tests only if tokens of specific types are in pool",
"no_auto_generate: dont generate tests for this one",
]
filterwarnings = [
"ignore:PytestUnknownMarkWarning"
]
14 changes: 7 additions & 7 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def meta_decimals(initial_decimals, metapool_token_type, decimals):
#
# @pytest.mark.only_for_token_types(2)
# class TestPoolsWithOracleToken:
@pytest.fixture()
@pytest.fixture(autouse=True)
def skip_by_token_type(request, pool_tokens):
only_for_token_types = request.node.get_closest_marker("only_for_token_types")
if only_for_token_types:
Expand All @@ -179,15 +179,15 @@ def skip_by_token_type(request, pool_tokens):
pytest.skip("skipped because no tokens for these types")


@pytest.fixture()
@pytest.fixture(autouse=True)
def skip_rebasing(request, swap):
only_for_token_types = request.node.get_closest_marker("skip_rebasing_tokens")
if only_for_token_types:
if 2 in get_asset_types_in_pool(swap):
pytest.skip("skipped because test includes rebasing tokens")


@pytest.fixture()
@pytest.fixture(autouse=True)
def skip_oracle(request, pool_tokens):
only_for_token_types = request.node.get_closest_marker("skip_oracle_tokens")
if only_for_token_types:
Expand All @@ -197,7 +197,7 @@ def skip_oracle(request, pool_tokens):
pytest.skip("skipped because test includes oraclised tokens")


@pytest.fixture()
@pytest.fixture(autouse=True)
def only_oracle(request, pool_tokens):
only_for_token_types = request.node.get_closest_marker("only_oracle_tokens")
if only_for_token_types:
Expand All @@ -207,7 +207,7 @@ def only_oracle(request, pool_tokens):
pytest.skip("skipped because test excludes oraclised tokens")


@pytest.fixture()
@pytest.fixture(autouse=True)
def only_rebasing(request, swap):
marker = request.node.get_closest_marker("contains_rebasing_tokens")
if marker:
Expand All @@ -219,15 +219,15 @@ def only_rebasing(request, swap):
# Usage
# @pytest.mark.only_for_pool_type(1)
# class TestMetaPool...
@pytest.fixture()
@pytest.fixture(autouse=True)
def skip_by_pool_type(request, pool_type):
only_for_pool_type = request.node.get_closest_marker("only_for_pool_type")
if only_for_pool_type:
if pool_type not in only_for_pool_type.args:
pytest.skip("skipped because another pool type")


@pytest.fixture(scope="session")
@pytest.fixture(scope="module")
def forked_chain():
rpc_url = os.getenv("WEB3_PROVIDER_URL")
assert rpc_url is not None, "Provider url is not set, add WEB3_PROVIDER_URL param to env"
Expand Down

0 comments on commit 06b398f

Please sign in to comment.