11import os
2- from pathlib import Path
32
43import pytest
54
@@ -66,28 +65,6 @@ def pytest_addoption(parser) -> None:
6665 parser .addoption ("--cli-api-key" , action = "store" , type = str , default = None , help = "Token necessary to access skills." )
6766
6867
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-
9168@pytest .hookimpl (hookwrapper = True )
9269def pytest_runtest_makereport (item , call ):
9370 outcome = yield
@@ -97,31 +74,3 @@ def pytest_runtest_makereport(item, call):
9774 if "NodeJS or npm is not installed" in str (report .longrepr ):
9875 msg = "This test requires NodeJS and npm to be installed. Please install them before running the tests."
9976 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