1
1
import os
2
- from pathlib import Path
3
2
4
3
import pytest
5
4
@@ -66,28 +65,6 @@ def pytest_addoption(parser) -> None:
66
65
parser .addoption ("--cli-api-key" , action = "store" , type = str , default = None , help = "Token necessary to access skills." )
67
66
68
67
69
- # content of conftest.py
70
- # def pytest_configure(config) -> None:
71
- # worker_id = os.environ.get("PYTEST_XDIST_WORKER")
72
- # if worker_id is not None:
73
- # os.makedirs("build/logs", exist_ok=True)
74
- # logging.basicConfig(
75
- # format=config.getini("log_file_format"),
76
- # filename=f"build/logs/tests_{worker_id}.log",
77
- # level=config.getini("log_file_level"),
78
- # )
79
-
80
-
81
- def is_git_lfs_pointer (file_path : Path ) -> bool :
82
- """Check if a file is a git LFS pointer file"""
83
- try :
84
- with open (file_path ) as f :
85
- first_line = f .readline ().strip ()
86
- return first_line == "version https://git-lfs.github.com/spec/v1"
87
- except Exception :
88
- return False
89
-
90
-
91
68
@pytest .hookimpl (hookwrapper = True )
92
69
def pytest_runtest_makereport (item , call ):
93
70
outcome = yield
@@ -97,31 +74,3 @@ def pytest_runtest_makereport(item, call):
97
74
if "NodeJS or npm is not installed" in str (report .longrepr ):
98
75
msg = "This test requires NodeJS and npm to be installed. Please install them before running the tests."
99
76
raise RuntimeError (msg )
100
-
101
-
102
- # Lets not run if we are in CI
103
-
104
-
105
- IS_CI = os .getenv ("CI" ) == "true" or os .getenv ("CIRCLECI" ) == "true"
106
-
107
-
108
- @pytest .fixture (autouse = IS_CI )
109
- def skip_lfs_tests (request ) -> None :
110
- """Skip tests that depend on git LFS files if they haven't been pulled"""
111
- # Get the test module path
112
- test_path = Path (request .module .__file__ )
113
-
114
- # Only run for integration tests
115
- try :
116
- cwd = Path .cwd ()
117
- except FileNotFoundError :
118
- return
119
- if not str (test_path ).startswith (str (cwd / "tests" / "integration" )):
120
- return
121
-
122
- try :
123
- expected = request .getfixturevalue ("expected" )
124
- if isinstance (expected , Path ) and is_git_lfs_pointer (expected ):
125
- pytest .skip (f"Test requires git LFS file { expected } which hasn't been pulled" )
126
- except Exception :
127
- pass
0 commit comments