Skip to content

Commit fd7e644

Browse files
committed
Fix Temp Test Dir
1 parent dcaae90 commit fd7e644

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cppython/test/pytest/fixtures.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,16 @@ def fixture_core_data(cppython_data: CPPythonData, project_data: ProjectData) ->
208208
name='project_configuration',
209209
scope='session',
210210
)
211-
def fixture_project_configuration() -> ProjectConfiguration:
211+
def fixture_project_configuration(tmp_path_factory: pytest.TempPathFactory) -> ProjectConfiguration:
212212
"""Project configuration fixture.
213213
214214
Here we provide overrides on the input variants so that we can use a temporary directory for testing purposes.
215215
216216
Returns:
217217
Configuration with temporary directory capabilities
218218
"""
219-
return ProjectConfiguration(project_root=Path(), version='0.1.0')
219+
workspace_path = tmp_path_factory.mktemp('test-project-')
220+
return ProjectConfiguration(project_root=workspace_path, version='0.1.0')
220221

221222

222223
@pytest.fixture(

tests/unit/core/test_resolution.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Test data resolution"""
22

3-
from pathlib import Path
43
from typing import Annotated
54

65
import pytest
@@ -27,7 +26,6 @@
2726
CPPythonModel,
2827
PEP621Configuration,
2928
ProjectConfiguration,
30-
ProjectData,
3129
)
3230
from cppython.utility.utility import TypeName
3331

@@ -90,7 +88,6 @@ class MockModel(CPPythonModel):
9088
@staticmethod
9189
def test_generator_resolve(project_configuration: ProjectConfiguration) -> None:
9290
"""Test generator resolution"""
93-
project_data = ProjectData(project_root=Path())
9491
cppython_local_configuration = CPPythonLocalConfiguration()
9592
cppython_global_configuration = CPPythonGlobalConfiguration()
9693

@@ -114,7 +111,6 @@ class MockGenerator(Generator):
114111
@staticmethod
115112
def test_provider_resolve(project_configuration: ProjectConfiguration) -> None:
116113
"""Test provider resolution"""
117-
project_data = ProjectData(project_root=Path())
118114
cppython_local_configuration = CPPythonLocalConfiguration()
119115
cppython_global_configuration = CPPythonGlobalConfiguration()
120116

@@ -138,7 +134,6 @@ class MockProvider(Provider):
138134
@staticmethod
139135
def test_scm_resolve(project_configuration: ProjectConfiguration) -> None:
140136
"""Test scm resolution"""
141-
project_data = ProjectData(project_root=Path())
142137
cppython_local_configuration = CPPythonLocalConfiguration()
143138
cppython_global_configuration = CPPythonGlobalConfiguration()
144139

0 commit comments

Comments
 (0)