Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
grizz committed Oct 18, 2024
1 parent 0982fb4 commit 8c44553
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 34 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ dev-dependencies = [
"tox-uv>=1.13.0",
"mypy>=0.950",
"pre-commit>=2.13",
"pyupgrade>=2.19",
"ruff>=0.1",
"markdown",
"markdown-include>=0.5,<1",
Expand Down
20 changes: 10 additions & 10 deletions tests/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ def test_handle_initial_sync_error(client_empty, monkeypatch):
"""

# Delete the file if exists
if os.path.exists("failed_entries_file.json"):
os.remove("failed_entries_file.json")
if os.path.exists("failed_entries.json"):
os.remove("failed_entries.json")

client = get_client()
rs = all_resources()
Expand All @@ -165,14 +165,14 @@ def mock_create_obj(row: dict, res):

with pytest.raises(client.backend.object_missing_error()):
client.get(Organization, 2) # Object with ID 2 should be missing
with open("failed_entries_file.json") as f:
with open("failed_entries.json") as f:
failed_objects = json.load(f)
assert len(failed_objects) == 1
assert failed_objects[0]["pk"] == 2

# Delete the file after the test
if os.path.exists("failed_entries_file.json"):
os.remove("failed_entries_file.json")
if os.path.exists("failed_entries.json"):
os.remove("failed_entries.json")


def test_handle_incremental_sync_success(client_empty):
Expand All @@ -194,8 +194,8 @@ def test_handle_incremental_sync_error(client_empty, monkeypatch):
Test error handling in _handle_incremental_sync.
"""
# Delete the file if exists
if os.path.exists("failed_entries_file.json"):
os.remove("failed_entries_file.json")
if os.path.exists("failed_entries.json"):
os.remove("failed_entries.json")

client = get_client()
rs = all_resources()
Expand All @@ -219,16 +219,16 @@ def mock_copy_object(new_obj):

# Assertions
assert client.get(Organization, 1) # Object with ID 1 should still exist
with open("failed_entries_file.json") as f:
with open("failed_entries.json") as f:
failed_objects = json.load(f)
assert len(failed_objects) >= 1
assert any(
entry["pk"] == 1 for entry in failed_objects
) # Check if object ID 1 is present

# Delete the file if exists
if os.path.exists("failed_entries_file.json"):
os.remove("failed_entries_file.json")
if os.path.exists("failed_entries.json"):
os.remove("failed_entries.json")


@pytest.mark.sync
Expand Down
23 changes: 0 additions & 23 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8c44553

Please sign in to comment.