Skip to content

Commit

Permalink
investigate failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Jul 27, 2024
1 parent b6ac589 commit bd67309
Show file tree
Hide file tree
Showing 11 changed files with 206 additions and 191 deletions.
378 changes: 190 additions & 188 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def django_db_setup(django_db_setup, django_db_blocker, fixtures): # noqa: PT004
@pytest.fixture
def files(settings, tmp_path):
"""Create a temporary MEDIA_ROOT directory and copy test data into it."""
media_path = Path(__file__).parent.joinpath("testing").joinpath("media")
settings.MEDIA_ROOT = tmp_path.joinpath("media")
media_path = Path(__file__).parent / "testing" / "media"
settings.MEDIA_ROOT = tmp_path / "media"
shutil.copytree(media_path, settings.MEDIA_ROOT)
return settings.MEDIA_ROOT

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pytest = [
"pytest-mock~=3.11",
"pytest-playwright>=0.4.3,<0.6.0",
"pytest-randomly~=3.15",
"pytest-xdist~=3.3",
"pytest-xdist[psutil]~=3.3",
]

[project.urls]
Expand Down Expand Up @@ -199,6 +199,7 @@ pythonpath = [".", "testing"]
addopts = '-p no:randomly -m "not e2e"'
markers = [
"e2e: marks tests as end-to-end tests using playwright (deselect with '-m \"not e2e\"')",
"files: marks tests that use the 'files' fixture",
]
filterwarnings = [
# fail on RemovedInDjango50Warning exception
Expand Down
1 change: 1 addition & 0 deletions rdmo/projects/tests/test_view_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def test_issue_send_post_email(db, client, username, password, project_id, issue
assert response.status_code == 404


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('issue_id', issues)
@pytest.mark.parametrize('project_id', projects)
Expand Down
1 change: 1 addition & 0 deletions rdmo/projects/tests/test_view_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ def test_project_delete_post(db, client, username, password, project_id):
assert Project.objects.filter(pk=project_id).first()


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
def test_project_export_xml(db, client, files, username, password, project_id):
Expand Down
2 changes: 2 additions & 0 deletions rdmo/projects/tests/test_view_project_create_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def test_project_create_import_post_upload_file_forbidden(db, client, settings):
assert response.status_code == 403


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
def test_project_create_import_post_import_file(db, settings, client, files, username, password):
client.login(username=username, password=password)
Expand Down Expand Up @@ -238,6 +239,7 @@ def test_project_create_import_post_import_file(db, settings, client, files, use
assert response.url.startswith('/account/login/')


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
def test_project_create_import_post_import_file_cancel(db, settings, client, files, username, password):
client.login(username=username, password=password)
Expand Down
2 changes: 2 additions & 0 deletions rdmo/projects/tests/test_view_project_update_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def test_project_update_import_post_upload_file_empty(db, client, username, pass
assert response.url.startswith('/account/login/')


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
def test_project_update_import_post_import_file(db, settings, client, files, username, password, project_id):
Expand Down Expand Up @@ -223,6 +224,7 @@ def test_project_update_import_post_import_file(db, settings, client, files, use
assert response.url.startswith('/account/login/')


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
def test_project_update_import_post_import_file_cancel(db, settings, client, files, username, password, project_id):
Expand Down
2 changes: 2 additions & 0 deletions rdmo/projects/tests/test_view_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def test_snapshot_create_get(db, client, username, password, project_id):
assert response.status_code == 302


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
def test_snapshot_create_post(db, client, files, username, password, project_id):
Expand Down Expand Up @@ -182,6 +183,7 @@ def test_snapshot_rollback_get(db, client, username, password, project_id, snaps
assert response.status_code == 404


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
@pytest.mark.parametrize('snapshot_id', snapshots)
Expand Down
1 change: 1 addition & 0 deletions rdmo/projects/tests/test_viewset_project_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def test_detail(db, client, username, password, project_id, snapshot_id):
assert response.status_code == 404


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
def test_create(db, client, files, username, password, project_id):
Expand Down
2 changes: 2 additions & 0 deletions rdmo/projects/tests/test_viewset_project_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ def test_set(db, client, username, password, project_id, value_id, set_values_co
assert Value.objects.count() == values_count


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
@pytest.mark.parametrize('value_id', values)
Expand All @@ -285,6 +286,7 @@ def test_file_get(db, client, files, username, password, project_id, value_id):
assert response.status_code == 404


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('project_id', projects)
@pytest.mark.parametrize('value_id', values)
Expand Down
1 change: 1 addition & 0 deletions rdmo/projects/tests/test_viewset_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_delete(db, client, username, password, value_id):
assert response.status_code == 401


@pytest.mark.files()
@pytest.mark.parametrize('username,password', users)
@pytest.mark.parametrize('value_id', values)
def test_file(db, client, files, username, password, value_id):
Expand Down

0 comments on commit bd67309

Please sign in to comment.