|
1 | 1 | import logging |
2 | 2 | import os |
3 | | -from pathlib import Path |
4 | | - |
5 | | -import pytest |
6 | 3 |
|
7 | 4 | from tests.shared.codemod.models import Size |
8 | 5 |
|
@@ -77,39 +74,3 @@ def pytest_configure(config): |
77 | 74 | filename=f"build/logs/tests_{worker_id}.log", |
78 | 75 | level=config.getini("log_file_level"), |
79 | 76 | ) |
80 | | - |
81 | | - |
82 | | -def is_git_lfs_pointer(file_path: Path) -> bool: |
83 | | - """Check if a file is a git LFS pointer file""" |
84 | | - try: |
85 | | - with open(file_path) as f: |
86 | | - first_line = f.readline().strip() |
87 | | - return first_line == "version https://git-lfs.github.com/spec/v1" |
88 | | - except Exception: |
89 | | - return False |
90 | | - |
91 | | - |
92 | | -@pytest.hookimpl(hookwrapper=True) |
93 | | -def pytest_runtest_makereport(item, call): |
94 | | - outcome = yield |
95 | | - report = outcome.get_result() |
96 | | - |
97 | | - if report.when == "call" and report.failed: |
98 | | - if "NodeJS or npm is not installed" in str(report.longrepr): |
99 | | - pytest.skip("Test requires NodeJS and npm to be installed") |
100 | | - |
101 | | - |
102 | | -@pytest.fixture(autouse=True) |
103 | | -def skip_lfs_tests(request): |
104 | | - """Skip tests that depend on git LFS files if they haven't been pulled""" |
105 | | - # Get the test module path |
106 | | - test_path = Path(request.module.__file__) |
107 | | - |
108 | | - # Only run for integration tests |
109 | | - if not str(test_path).startswith(str(Path.cwd() / "tests" / "integration")): |
110 | | - return |
111 | | - |
112 | | - # Get the expected diff path from the test's expected fixture |
113 | | - expected = request.getfixturevalue("expected") |
114 | | - if isinstance(expected, Path) and is_git_lfs_pointer(expected): |
115 | | - pytest.skip(f"Test requires git LFS file {expected} which hasn't been pulled") |
0 commit comments