Skip to content

Commit

Permalink
register marks, document python and pytest dependencies, and test the…
Browse files Browse the repository at this point in the history
… full matrix with tox and travis
  • Loading branch information
brianmaissy committed May 31, 2019
1 parent d3e5615 commit df3ed25
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 20 deletions.
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
dist: xenial
language: python
python: "3.5"
env:
- TOX_ENV=py35
- TOX_ENV=py34
- TOX_ENV=py33
- TOX_ENV=py27
- TOX_ENV=py26
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "pypy"
install:
- pip install tox
- pip install python-coveralls
env:
- TOX_PYTHON_VERSION=$(if [ $TRAVIS_PYTHON_VERSION = "pypy" ]; then echo "pypy"; else echo py$TRAVIS_PYTHON_VERSION | tr -d .; fi)
script:
- tox -e $TOX_ENV
- tox -e $(tox -l | grep $TOX_PYTHON_VERSION | paste -sd "," -)
after_success:
coveralls
- coveralls
sudo: false
6 changes: 6 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ second-to-last) or relative (i.e. run this test before this other test).
you read here isn't currently implemented, rest assured that I am working
on it (or feel free to ping me: https://github.com/ftobia)
Supported python and pytest versions
------------------------------------

pytest-ordering supports python 2.7, 3.4, 3.5, 3.6, 3.7, and pypy, and is
compatible with pytest 3.6.0 or newer.


Quickstart
----------
Expand Down
14 changes: 12 additions & 2 deletions pytest_ordering/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,23 @@
def pytest_configure(config):
"""Register the "run" marker."""

provided_by_pytest_ordering = (
'Provided by pytest-ordering. '
'See also: http://pytest-ordering.readthedocs.org/'
)

config_line = (
'run: specify ordering information for when tests should run '
'in relation to one another. Provided by pytest-ordering. '
'See also: http://pytest-ordering.readthedocs.org/'
'in relation to one another. ' + provided_by_pytest_ordering
)
config.addinivalue_line('markers', config_line)

for mark_name in orders_map.keys():
config_line = '{}: run test {}. {}'.format(mark_name,
mark_name.replace('_', ' '),
provided_by_pytest_ordering)
config.addinivalue_line('markers', config_line)


def pytest_collection_modifyitems(session, config, items):
grouped_items = {}
Expand Down
9 changes: 5 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
'pytest_ordering = pytest_ordering',
]
},
install_requires=['pytest'],
install_requires=['pytest>=3.6'],
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
Expand All @@ -37,11 +37,12 @@
'Topic :: Utilities',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: PyPy',
],
)
7 changes: 5 additions & 2 deletions tests/test_ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,10 @@ def test_5(self): pass
assert item_names_for(tests_content) == ['test_3', 'test_4', 'test_5', 'test_1', 'test_2']


def test_run_marker_registered(capsys):
pytest.main('--markers')
def test_markers_registered(capsys):
pytest.main(['--markers'])
out, err = capsys.readouterr()
assert '@pytest.mark.run' in out
assert '@pytest.mark.first' in out
assert '@pytest.mark.last' in out
assert out.count('Provided by pytest-ordering') == 17
17 changes: 14 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# content of: tox.ini, put in same dir as setup.py
[tox]
envlist = py26,py27,py33,py34,py35,pypy
envlist = {py27,py34,py35,py36,py37,pypy}-pytest{36,37,38,39,310,40,41,42,43,44,45}
[testenv]
deps=pytest
deps =
pytest36: pytest>=3.6,<3.7
pytest37: pytest>=3.7,<3.8
pytest38: pytest>=3.8,<3.9
pytest39: pytest>=3.9,<3.10
pytest310: pytest>=3.10,<3.11
pytest40: pytest>=4.0,<4.1
pytest41: pytest>=4.1,<4.2
pytest42: pytest>=4.2,<4.3
pytest43: pytest>=4.3,<4.4
pytest44: pytest>=4.4,<4.5
pytest45: pytest>=4.5,<4.6
pytest-cov
commands=
commands =
coverage run --source=pytest_ordering -m py.test tests
coverage report -m --fail-under=95

0 comments on commit df3ed25

Please sign in to comment.