22
33# from pathlib import Path
44from pathlib import Path
5- from typing import cast
65
76import pytest
87
2827 PyProject ,
2928 ToolData ,
3029)
31- from cppython .test .data .variants import (
32- cppython_global_variants ,
33- cppython_local_variants ,
34- pep621_variants ,
35- project_variants ,
36- )
37- from cppython .test .schema import Variant
30+ from cppython .utility .utility import TypeName
3831
3932
4033@pytest .fixture (
@@ -58,26 +51,22 @@ def fixture_install_path(tmp_path_factory: pytest.TempPathFactory) -> Path:
5851@pytest .fixture (
5952 name = 'pep621_configuration' ,
6053 scope = 'session' ,
61- params = pep621_variants .variants ,
6254)
63- def fixture_pep621_configuration (request : pytest . FixtureRequest ) -> Variant [ PEP621Configuration ] :
55+ def fixture_pep621_configuration () -> PEP621Configuration :
6456 """Fixture defining all testable variations of PEP621
6557
66- Args:
67- request: Parameterization list
68-
6958 Returns:
7059 PEP621 variant
7160 """
72- return cast ( Variant [ PEP621Configuration ], request . param )
61+ return PEP621Configuration ( name = 'unnamed' , version = '1.0.0' )
7362
7463
7564@pytest .fixture (
7665 name = 'pep621_data' ,
7766 scope = 'session' ,
7867)
7968def fixture_pep621_data (
80- pep621_configuration : Variant [ PEP621Configuration ] , project_configuration : Variant [ ProjectConfiguration ]
69+ pep621_configuration : PEP621Configuration , project_configuration : ProjectConfiguration
8170) -> PEP621Data :
8271 """Resolved project table fixture
8372
@@ -88,58 +77,40 @@ def fixture_pep621_data(
8877 Returns:
8978 The resolved project table
9079 """
91- return resolve_pep621 (pep621_configuration . configuration , project_configuration . configuration , None )
80+ return resolve_pep621 (pep621_configuration , project_configuration , None )
9281
9382
9483@pytest .fixture (
9584 name = 'cppython_local_configuration' ,
9685 scope = 'session' ,
97- params = cppython_local_variants .variants ,
9886)
99- def fixture_cppython_local_configuration (
100- request : pytest .FixtureRequest , install_path : Path
101- ) -> Variant [CPPythonLocalConfiguration ]:
87+ def fixture_cppython_local_configuration (install_path : Path ) -> CPPythonLocalConfiguration :
10288 """Fixture defining all testable variations of CPPythonData
10389
10490 Args:
105- request: Parameterization list
10691 install_path: The temporary install directory
10792
10893 Returns:
10994 Variation of CPPython data
11095 """
111- cppython_local_configuration = cast (Variant [CPPythonLocalConfiguration ], request .param )
112-
113- data = cppython_local_configuration .configuration .model_dump (by_alias = True )
114-
115- # Pin the install location to the base temporary directory
116- data ['install-path' ] = install_path
117-
118- # Fill the plugin names with mocked values
119- data ['provider-name' ] = 'mock'
120- data ['generator-name' ] = 'mock'
96+ cppython_local_configuration = CPPythonLocalConfiguration (
97+ install_path = install_path , provider_name = TypeName ('mock' ), generator_name = TypeName ('mock' )
98+ )
12199
122- new_configuration = CPPythonLocalConfiguration (** data )
123- return Variant [CPPythonLocalConfiguration ](configuration = new_configuration )
100+ return cppython_local_configuration
124101
125102
126103@pytest .fixture (
127104 name = 'cppython_global_configuration' ,
128105 scope = 'session' ,
129- params = cppython_global_variants .variants ,
130106)
131- def fixture_cppython_global_configuration (request : pytest . FixtureRequest ) -> Variant [ CPPythonGlobalConfiguration ] :
107+ def fixture_cppython_global_configuration () -> CPPythonGlobalConfiguration :
132108 """Fixture defining all testable variations of CPPythonData
133109
134- Args:
135- request: Parameterization list
136-
137110 Returns:
138111 Variation of CPPython data
139112 """
140- cppython_global_configuration = cast (Variant [CPPythonGlobalConfiguration ], request .param )
141-
142- return cppython_global_configuration
113+ return CPPythonGlobalConfiguration ()
143114
144115
145116@pytest .fixture (
@@ -193,8 +164,8 @@ def fixture_plugin_cppython_data(
193164 scope = 'session' ,
194165)
195166def fixture_cppython_data (
196- cppython_local_configuration : Variant [ CPPythonLocalConfiguration ] ,
197- cppython_global_configuration : Variant [ CPPythonGlobalConfiguration ] ,
167+ cppython_local_configuration : CPPythonLocalConfiguration ,
168+ cppython_global_configuration : CPPythonGlobalConfiguration ,
198169 project_data : ProjectData ,
199170 plugin_cppython_data : PluginCPPythonData ,
200171) -> CPPythonData :
@@ -210,8 +181,8 @@ def fixture_cppython_data(
210181 The resolved CPPython table
211182 """
212183 return resolve_cppython (
213- cppython_local_configuration . configuration ,
214- cppython_global_configuration . configuration ,
184+ cppython_local_configuration ,
185+ cppython_global_configuration ,
215186 project_data ,
216187 plugin_cppython_data ,
217188 )
@@ -236,29 +207,23 @@ def fixture_core_data(cppython_data: CPPythonData, project_data: ProjectData) ->
236207@pytest .fixture (
237208 name = 'project_configuration' ,
238209 scope = 'session' ,
239- params = project_variants .variants ,
240210)
241- def fixture_project_configuration (request : pytest . FixtureRequest ) -> Variant [ ProjectConfiguration ] :
211+ def fixture_project_configuration () -> ProjectConfiguration :
242212 """Project configuration fixture.
243213
244214 Here we provide overrides on the input variants so that we can use a temporary directory for testing purposes.
245215
246- Args:
247- request: Parameterized configuration data
248- tmp_path_factory: Factory for centralized temporary directories
249-
250216 Returns:
251217 Configuration with temporary directory capabilities
252218 """
253- configuration = cast (Variant [ProjectConfiguration ], request .param )
254- return configuration
219+ return ProjectConfiguration (project_root = Path (), version = '0.1.0' )
255220
256221
257222@pytest .fixture (
258223 name = 'project_data' ,
259224 scope = 'session' ,
260225)
261- def fixture_project_data (project_configuration : Variant [ ProjectConfiguration ] ) -> ProjectData :
226+ def fixture_project_data (project_configuration : ProjectConfiguration ) -> ProjectData :
262227 """Fixture that creates a project space at 'workspace/test_project/pyproject.toml'
263228
264229 Args:
@@ -267,13 +232,13 @@ def fixture_project_data(project_configuration: Variant[ProjectConfiguration]) -
267232 Returns:
268233 A project data object that has populated a function level temporary directory
269234 """
270- return resolve_project_configuration (project_configuration . configuration )
235+ return resolve_project_configuration (project_configuration )
271236
272237
273238@pytest .fixture (name = 'project' )
274239def fixture_project (
275- cppython_local_configuration : Variant [ CPPythonLocalConfiguration ] ,
276- pep621_configuration : Variant [ PEP621Configuration ] ,
240+ cppython_local_configuration : CPPythonLocalConfiguration ,
241+ pep621_configuration : PEP621Configuration ,
277242) -> PyProject :
278243 """Parameterized construction of PyProject data
279244
@@ -284,5 +249,5 @@ def fixture_project(
284249 Returns:
285250 All the data as one object
286251 """
287- tool = ToolData (cppython = cppython_local_configuration . configuration )
288- return PyProject (project = pep621_configuration . configuration , tool = tool )
252+ tool = ToolData (cppython = cppython_local_configuration )
253+ return PyProject (project = pep621_configuration , tool = tool )
0 commit comments