Skip to content

Commit 8b91aa3

Browse files
committed
refactor: Update test imports to use new modular structure
Refactored all test files in tests/changelog/ to import directly from the new modular structure instead of relying on backward compatibility imports from changelog_helper.py. **Import mapping:** - DiffStix: changelog_helper → core.diff_stix - AttackChangesEncoder: changelog_helper → core.attack_changes_encoder - AttackObjectVersion, version utils: changelog_helper → utils.version_utils - STIX utilities: changelog_helper → utils.stix_utils - URL utilities: changelog_helper → utils.url_utils - HTML/markdown formatters: changelog_helper → formatters.html_output - Layer output: changelog_helper → formatters.layer_output - CLI argument parser: changelog_helper → cli.argument_parser **Files updated (17 total):** Core tests: - test_versioning.py - version_utils imports - test_stix_processing.py - stix_utils + url_utils imports - test_change_detection.py - stix_utils + version_utils imports - test_diffstix_methods.py - core.diff_stix import - test_missing_functions.py - multiple module imports Integration tests: - test_diffstix_behavioral.py - core.diff_stix import - test_diffstix_minimal_data.py - core.diff_stix import - test_diffstix_multi_domain.py - core.diff_stix import - test_regression_baseline.py - core.attack_changes_encoder import - test_network.py - core.diff_stix import Formatting tests: - test_html_output.py - formatters.html_output imports - test_json_output.py - core.attack_changes_encoder + utils.version_utils imports - test_layer_output.py - formatters.layer_output import - test_markdown_output.py - formatters.html_output + utils.version_utils imports Other: - conftest.py - core.diff_stix import - error_handling/test_errors.py - core.diff_stix + utils.version_utils imports - cli/test_argument_handling.py - cli.argument_parser import **Benefits:** - Tests now use the actual module structure - Clearer separation of concerns in test imports - Removes dependency on backward compatibility layer - Makes module responsibilities more explicit - Easier to identify which module a function belongs to
1 parent da3450d commit 8b91aa3

17 files changed

Lines changed: 26 additions & 38 deletions

tests/changelog/cli/test_argument_handling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import pytest
66

7-
from mitreattack.diffStix.changelog_helper import get_parsed_args
7+
from mitreattack.diffStix.cli.argument_parser import get_parsed_args
88

99

1010
class TestArgumentHandling:

tests/changelog/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import pytest
1414

15-
from mitreattack.diffStix.changelog_helper import DiffStix
15+
from mitreattack.diffStix.core.diff_stix import DiffStix
1616

1717
# Import test utilities
1818
from tests.changelog.test_utils import (

tests/changelog/core/test_change_detection.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
"""Tests for change detection and grouping logic."""
22

3-
from mitreattack.diffStix.changelog_helper import (
4-
cleanup_values,
5-
is_patch_change,
6-
)
3+
from mitreattack.diffStix.utils.stix_utils import cleanup_values
4+
from mitreattack.diffStix.utils.version_utils import is_patch_change
75

86

97
class TestChangeDetection:

tests/changelog/core/test_diffstix_methods.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from mitreattack.diffStix.changelog_helper import DiffStix
5+
from mitreattack.diffStix.core.diff_stix import DiffStix
66

77

88
class TestDiffStixMethods:

tests/changelog/core/test_missing_functions.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33
import json
44
from pathlib import Path
55

6-
from mitreattack.diffStix.changelog_helper import (
7-
AttackChangesEncoder,
8-
AttackObjectVersion,
9-
get_relative_data_component_url,
10-
layers_dict_to_files,
11-
markdown_to_html,
12-
write_detailed_html,
13-
)
6+
from mitreattack.diffStix.core.attack_changes_encoder import AttackChangesEncoder
7+
from mitreattack.diffStix.formatters.html_output import markdown_to_html, write_detailed_html
8+
from mitreattack.diffStix.formatters.layer_output import layers_dict_to_files
9+
from mitreattack.diffStix.utils.url_utils import get_relative_data_component_url
10+
from mitreattack.diffStix.utils.version_utils import AttackObjectVersion
1411

1512

1613
class TestMissingFunctions:

tests/changelog/core/test_stix_processing.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
"""Tests for STIX object processing functionality."""
22

3-
from mitreattack.diffStix.changelog_helper import (
4-
deep_copy_stix,
5-
get_attack_id,
6-
get_relative_url_from_stix,
7-
has_subtechniques,
8-
)
3+
from mitreattack.diffStix.utils.stix_utils import deep_copy_stix, get_attack_id, has_subtechniques
4+
from mitreattack.diffStix.utils.url_utils import get_relative_url_from_stix
95

106

117
class TestStixProcessing:

tests/changelog/core/test_versioning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import pytest
44

5-
from mitreattack.diffStix.changelog_helper import (
5+
from mitreattack.diffStix.utils.version_utils import (
66
AttackObjectVersion,
77
get_attack_object_version,
88
is_major_version_change,

tests/changelog/error_handling/test_errors.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44

55
import pytest
66

7-
from mitreattack.diffStix.changelog_helper import (
8-
DiffStix,
9-
get_attack_object_version,
10-
)
7+
from mitreattack.diffStix.core.diff_stix import DiffStix
8+
from mitreattack.diffStix.utils.version_utils import get_attack_object_version
119

1210

1311
class TestErrorHandling:

tests/changelog/formatting/test_html_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import json
44

5-
from mitreattack.diffStix.changelog_helper import markdown_to_html, write_detailed_html
5+
from mitreattack.diffStix.formatters.html_output import markdown_to_html, write_detailed_html
66

77

88
class TestHtmlOutput:

tests/changelog/formatting/test_json_output.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import json
44

5-
from mitreattack.diffStix.changelog_helper import AttackChangesEncoder, AttackObjectVersion
5+
from mitreattack.diffStix.core.attack_changes_encoder import AttackChangesEncoder
6+
from mitreattack.diffStix.utils.version_utils import AttackObjectVersion
67

78

89
class TestJsonOutput:

0 commit comments

Comments
 (0)