Skip to content

[CI/CD] allow to skip tests that are know to lack a C (or Python) implementation. #120792

@picnixz

Description

@picnixz

I don't know whether it's already possible to do it but I would like to have the possibility to make the CI/CD pass (or maybe fail to avoid surprises, but with a specific job) even if I do not have yet the C implementation. The idea is to have the following possibility:

class MixinTest:
	def test(self):
		# some code that is tested with something written in C or in Python
		...

	@test.support.has_implementation('c')
	def test_c_only(self):
		# some code that is tested only if something is written in C
		...

	@test.support.has_implementation('py')
	def test_python_only(self):
		# some code that is tested only if something is written in Python
		...

In #120728, I currently have the tests skipped because whenever I push a commit, the CI/CD would try to run tests for both the Python implementation and the C implementation (e.g., for BytesIO, or datetime). This might be quite annoying when we only want to add the Python implementation and check whether the tests are correct or not (if they already fail here, it doesn't make sense to implement the C implementation).

Actually, this issue essentially arises from the fact that mixin classes are used to avoid test duplications, but those mixin classes do not give the possibility to check whether the interface being tested is the C or the Python implementation (for instance, we could have data = self.myclass(...) where myclass is _pyio.BytesIO (in Python) or io.BytesIO (in C)).

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions