Skip to content

Commit 155faec

Browse files
committed
Make pytest_ordering a package. Include __version__ (#4).
1 parent 0ec3796 commit 155faec

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

pytest_ordering.py renamed to pytest_ordering/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import re
22

3+
from ._version import __version__
4+
5+
36
replacements = {
47
'first': 0,
58
'second': 1,

pytest_ordering/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.2'

setup.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
#!/usr/bin/env python
22

33
from setuptools import setup
4+
import os
5+
6+
__here__ = os.path.abspath(os.path.dirname(__file__))
7+
8+
# define __version__
9+
# execfile doesn't exist in python 3
10+
# see: http://stackoverflow.com/questions/6357361/alternative-to-execfile-in-python-3-2
11+
exec(open(os.path.join(__here__, 'pytest_ordering', '_version.py')).read())
412

513

614
setup(
715
name='pytest-ordering',
816
description='pytest plugin to run your tests in a specific order',
9-
version='0.2',
17+
version=__version__,
1018
author='Frank Tobia',
1119
author_email='[email protected]',
1220
url='https://github.com/ftobia/pytest-ordering',
13-
py_modules=['pytest_ordering'],
21+
packages=['pytest_ordering'],
1422
entry_points = {
1523
'pytest11': [
1624
'pytest_ordering = pytest_ordering',

tests/test_ordering.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
from pytest_ordering import _order_tests
8+
import pytest_ordering
99

1010
__here__ = os.path.dirname(os.path.abspath(__file__))
1111

@@ -44,3 +44,8 @@ def test_ordering(module_name, capsys):
4444
relative_filename = 'tests/{0}.py'.format(module_name)
4545
out, err = capsys.readouterr()
4646
assert list(module.ordering) == get_order(out, relative_filename)
47+
48+
49+
def test_version():
50+
assert hasattr(pytest_ordering, '__version__')
51+
assert re.match(r'[0-9]+\.[0-9]+(\.[0-9]+)?$', pytest_ordering.__version__)

0 commit comments

Comments
 (0)