()
| 242 | |
| 243 | @pytest.fixture |
| 244 | def rule_runner() -> RuleRunner: |
| 245 | rule_runner = PythonRuleRunner( |
| 246 | rules=[ |
| 247 | PythonTestsGeneratorTarget.register_plugin_field( |
| 248 | InjectPackPythonPathField, as_moved_field=True |
| 249 | ), |
| 250 | PythonTestTarget.register_plugin_field(InjectPackPythonPathField), |
| 251 | *python_target_types_rules(), |
| 252 | # TODO: not sure if we need a QueryRule for every rule... |
| 253 | *python_pack_content.rules(), |
| 254 | QueryRule( |
| 255 | PackContentResourceTargetsOfType, |
| 256 | (PackContentResourceTargetsOfTypeRequest,), |
| 257 | ), |
| 258 | QueryRule( |
| 259 | PackContentPythonEntryPoints, (PackContentPythonEntryPointsRequest,) |
| 260 | ), |
| 261 | QueryRule(PackPythonLibs, (PackPythonLibsRequest,)), |
| 262 | *python_module_mapper.rules(), |
| 263 | QueryRule( |
| 264 | FirstPartyPythonMappingImpl, (St2PythonPackContentMappingMarker,) |
| 265 | ), |
| 266 | *python_path_rules.rules(), |
| 267 | QueryRule(PackPythonPath, (PackPythonPathRequest,)), |
| 268 | QueryRule(PytestPluginSetup, (PytestPackTestRequest,)), |
| 269 | ], |
| 270 | target_types=[ |
| 271 | PackContentResourceTarget, |
| 272 | PackMetadata, |
| 273 | PythonSourceTarget, |
| 274 | PythonSourcesGeneratorTarget, |
| 275 | PythonTestTarget, |
| 276 | PythonTestsGeneratorTarget, |
| 277 | ], |
| 278 | ) |
| 279 | write_test_files(rule_runner) |
| 280 | args = ["--source-root-patterns=packs/*"] |
| 281 | rule_runner.set_options(args, env_inherit={"PATH", "PYENV_ROOT", "HOME"}) |
| 282 | return rule_runner |
nothing calls this directly
no test coverage detected