File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1
1
import logging
2
2
import os
3
+ from pathlib import Path
4
+
5
+ import pytest
3
6
4
7
from codegen .sdk .testing .models import Size
5
8
@@ -74,3 +77,29 @@ def pytest_configure(config):
74
77
filename = f"build/logs/tests_{ worker_id } .log" ,
75
78
level = config .getini ("log_file_level" ),
76
79
)
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 .fixture (autouse = True )
93
+ def skip_lfs_tests (request ):
94
+ """Skip tests that depend on git LFS files if they haven't been pulled"""
95
+ # Get the test module path
96
+ test_path = Path (request .module .__file__ )
97
+
98
+ # Only run for integration tests
99
+ if not str (test_path ).startswith (str (Path .cwd () / "tests" / "integration" )):
100
+ return
101
+
102
+ # Get the expected diff path from the test's expected fixture
103
+ expected = request .getfixturevalue ("expected" )
104
+ if isinstance (expected , Path ) and is_git_lfs_pointer (expected ):
105
+ pytest .skip (f"Test requires git LFS file { expected } which hasn't been pulled" )
You can’t perform that action at this time.
0 commit comments