GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - pytest-dev/pytest-order: pytest plugin that allows to customize the test execution order

BranchesTags
Open more actions menu

Latest commit

 

History

377 Commits
377 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.vscode
.vscode
 
 
docs
docs
 
 
example
example
 
 
perf_tests
perf_tests
 
 
src/pytest_order
src/pytest_order
 
 
tests
tests
 
 
.coveragerc
.coveragerc
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
.readthedocs.yaml
.readthedocs.yaml
 
 
AUTHORS
AUTHORS
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
MANIFEST.in
MANIFEST.in
 
 
README.md
README.md
 
 
old_issues.md
old_issues.md
 
 
pyproject.toml
pyproject.toml
 
 
requirements.txt
requirements.txt
 
 
requirements_dev.txt
requirements_dev.txt
 
 
tox.ini
tox.ini
 
 

Repository files navigation

pytest-order - a pytest plugin to order test execution

PyPI version Testsuite DocBuild codecov Python version PyPI - Downloads

pytest-order is a pytest plugin that allows you to customize the order in which your tests are run. It uses the marker order that defines when a specific test shall run, either by using an ordinal number, or by specifying the relationship to other tests.

pytest-order is a fork of pytest-ordering that provides additional features like ordering relative to other tests.

pytest-order works with all supported Python versions, with pytest versions >= 6.2.4 for Python < 3.14, and pytest >= 7.4 for Python 3.14. pytest-order runs on Linux, macOS and Windows.

Documentation

Apart from this overview, the following information is available:

  • usage documentation for the latest release
  • usage documentation for the current main branch
  • most examples shown in the documentation can also be found in the repository
  • the Release Notes with a list of changes in the latest versions
  • a list of open issues in the original project and their handling in pytest-order

Features

pytest-order provides the following features:

  • ordering of tests by index
  • ordering of tests both from the start and from the end (via negative index)
  • ordering of tests relative to each other (via the before and after marker attributes)
  • session-, module- and class-scope ordering via the order-scope option
  • directory scope ordering via the order-scope-level option
  • hierarchical module and class-level ordering via the order-group-scope option
  • ordering tests with pytest-dependency markers if using the order-dependencies option, more information about pytest-dependency compatibility here
  • sparse ordering of tests via the sparse-ordering option
  • usage of custom markers for ordering using the order-marker-prefix option

Overview

(adapted from the original project)

Have you ever wanted to easily run one of your tests before any others run? Or run some tests last? Or run this one test before that other test? Or make sure that this group of tests runs after this other group of tests?

Now you can.

Install with:

pip install pytest-order

This defines the order marker that you can use in your code with different attributes.

For example, this code:

import pytest

@pytest.mark.order(2)
def test_foo():
    assert True

@pytest.mark.order(1)
def test_bar():
    assert True

yields the output:

$ pytest test_foo.py -vv
============================= test session starts ==============================
platform linux -- Python 3.11.11, pytest-9.0.3, pluggy-1.6.0 -- env/bin/python
plugins: order
collected 2 items

test_foo.py:7: test_bar PASSED
test_foo.py:3: test_foo PASSED

=========================== 2 passed in 0.01 seconds ===========================

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the MIT license, pytest-order is free and open source software.

History

This is a fork of pytest-ordering. That project is not maintained anymore, and there are several helpful PRs that are now integrated into pytest-order. The idea and most of the initial code has been created by Frank Tobia, the author of that plugin, and contributors.

While derived from pytest_ordering, pytest-order is not compatible with pytest-ordering due to the changed marker name (order instead of run). Additional markers defined in pytest_ordering are all integrated into the order marker (for a rationale see also this issue).

Ordering relative to other tests and all the configuration options are not available in the released version of pytest-ordering. However, most of these features are derived from or inspired by issues and pull requests already existing in pytest-ordering.

About

pytest plugin that allows to customize the test execution order

pytest-order.readthedocs.io

Topics

pytest-pluginpython

Resources

Readme
License
Activity
Custom properties

Stars

211 stars

Watchers

1 watching

Forks

19 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.