Skip to content

Commit

Permalink
linting errors fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesRobertsonGames committed Aug 1, 2024
1 parent c1b7795 commit 7639c1a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 111 deletions.
10 changes: 3 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@
]



NUMPY_2_CHANGES = json.loads(Path("numpy2_patch.json").read_text())


Expand All @@ -287,13 +286,13 @@ def apply_numpy2_changes(record, subdir, filename):
- filename: The filename of the record.
"""
relevant_changes = [
change for change in NUMPY_2_CHANGES
change for change in NUMPY_2_CHANGES
if change['subdirectory'] == subdir and change['filename'] == filename
]

if not relevant_changes:
return

for change in relevant_changes:
depends = _get_dependency_list(record, change['type'])
if depends is None:
Expand Down Expand Up @@ -1616,9 +1615,6 @@ def do_hotfixes(base_dir):
def main():
base_dir = join(dirname(__file__), CHANNEL_NAME)
do_hotfixes(base_dir)
if NUMPY_2_CHANGES != {}:
# write_csv()
pass


if __name__ == "__main__":
Expand Down
99 changes: 0 additions & 99 deletions test_numpy.py

This file was deleted.

11 changes: 6 additions & 5 deletions tests/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import pytest


@pytest.fixture
def json_data():
"""Fixture to load the JSON data from the output file."""
Expand All @@ -12,6 +13,7 @@ def json_data():
with open(json_file, 'r') as f:
return json.load(f)


def test_json_structure(json_data):
"""Test the overall structure of the JSON output."""
assert isinstance(json_data, list), "JSON root should be a list"
Expand All @@ -29,19 +31,22 @@ def test_json_structure(json_data):
if missing_subdirs:
print(f"Note: The following subdirs are not present in the JSON output: {', '.join(missing_subdirs)}")


def test_change_types(json_data):
"""Test that change types are either 'dep' or 'constr'."""
valid_types = {'dep', 'constr'}
for item in json_data:
assert item['type'] in valid_types, \
f"Invalid change type for {item['filename']} in {item['subdirectory']}: {item['type']}"


def test_numpy_changes(json_data):
"""Test that changes are related to numpy or numpy-base."""
for item in json_data:
assert 'numpy' in item['original'].lower() or 'numpy-base' in item['original'].lower(), \
f"Change for {item['filename']} in {item['subdirectory']} is not related to numpy: {item['original']}"


def test_version_bounds(json_data):
"""Test that updated dependencies have the correct version bounds."""
for item in json_data:
Expand All @@ -51,12 +56,8 @@ def test_version_bounds(json_data):
f"doesn't have correct upper bound: {item['updated']}"
)

def test_changes_present(json_data):
"""Test that there are actually changes in the output."""
assert json_data, "JSON output should not be empty"
assert len(set(item['subdirectory'] for item in json_data)) > 0, "At least one subdir should have changes"

def test_changes_present(json_data):
"""Test that there are actually changes in the output."""
assert json_data, "JSON output should not be empty"
assert len(set(item['subdirectory'] for item in json_data)) > 0, "At least one subdir should have changes"
assert len(set(item['subdirectory'] for item in json_data)) > 0, "At least one subdir should have changes"

0 comments on commit 7639c1a

Please sign in to comment.