Skip to content

Commit d037494

Browse files
committed
add a trick to skip metrics tests that create roles
1 parent ab79cb7 commit d037494

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

recoco/apps/metrics/tests/test_command.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os
12
import random
23
import string
34
from io import StringIO
@@ -56,6 +57,17 @@ def test_full_command(self, settings):
5657
)
5758
assert cursor.fetchone()[0] == 0
5859

60+
@pytest.mark.skipif(
61+
os.environ.get("SKIP_TEST_METRICS_CREATE_ROLES") == "true",
62+
reason="Skipping metrics tests that create roles",
63+
)
64+
@pytest.mark.django_db(transaction=True)
65+
def test_full_command_create_roles(self, settings):
66+
random_prefix = "".join(
67+
random.choices(string.ascii_lowercase, k=10) # noqa: S311
68+
)
69+
settings.METRICS_PREFIX = f"metrics_{random_prefix}"
70+
5971
call_command("update_materialized_views", create_roles=True)
6072

6173
with connection.cursor() as cursor:

0 commit comments

Comments
 (0)