pytest-dev / pytest-dev/pytest
markers - a rough path into the future (and object based markers)
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
this is a rough sketch of alternative to #5418 and builds upon marks - proposals for a new api and a path forward
as a starting point we should elevate actual markers from the need to register a name with us,
they should use the solid python name-spacing systems using modules and type names
so we would switch the marker implementation from something like
Mark("skipif", (), {"condition": ..., "reason": ...}) to ConditionalSkip(condition=..., reason=...)
after freeing the actual marker registration up, we can then follow up with registering the names of marker constructors
something like the following in a conftest.py/plugin
# use a hook to create 0-N object based markers for a classical declaration
# should warn if no implementation triggered and no element was in the ini-lines for markers
def pytest_make_marker(config, name, args, kwargs):
...
return MyMarker(*args, **kwargs)
# used to map well known mark names to their implementation,
# more than one one module may implement the same marker,
# implemented by the pytest core `pytest_make_marker` hook
@pytest.markspec
def skip_if(condition, reason=None) -> Option[ConditionalSkip]:
return ConditionalSkip(condition, reason)
# make a marker known that acts as a symbol, perhaps this should use a different function name
xfail = pytest.markspec.symbol("xfail")
lookup should happen in terms of types for the new style markers
the name based lookup need to be expanded in terms of looking up the types that natch a name
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked proposal and alternative issue #5418, then trace the existing marker implementation and registration behavior. The issue suggests entry points in conftest.py or a plugin, including pytest_make_marker and pytest.markspec, but it does not define an agreed design or concrete completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100