Skip to content

Commit

Permalink
Minimal configuration for pytest
Browse files Browse the repository at this point in the history
Configure setup.cfg for pytest

python-ldap uses a non-standard configuration for tests.

Also, fix test class:
TestSubschemaUrlfetch must be a subclass of TestCase, not TestSuite.

https://github.com/python-ldap/python-ldap/pull/114
Signed-off-by: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
Christian Heimes authored and Petr Viktorin committed Dec 11, 2017
1 parent 44f7ba2 commit 2ad72f2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __pycache__/
.tox
.coverage*
!.coveragerc
/.cache

# shared libs installed by 'setup.py test'
/Lib/*.so*
Expand Down
2 changes: 1 addition & 1 deletion Doc/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Run reference leak tests::

$ cd path/to/python-ldap
$ /tmp/refleak/bin/pip install --upgrade .
$ /tmp/refleak/bin/pytest -v -R: Tests/t_*.py
$ /tmp/refleak/bin/pytest -v -R:

Run ``/tmp/refleak/bin/pip install --upgrade .`` every time a file outside
of ``Tests/`` is modified.
Expand Down
3 changes: 2 additions & 1 deletion Tests/t_ldap_schema_subentry.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
os.path.join(HERE, 'data', 'subschema-openldap-all.ldif'),
)


class TestSubschemaLDIF(unittest.TestCase):
"""
test ldap.schema.SubSchema with subschema subentries read from LDIF files
Expand All @@ -49,7 +50,7 @@ def test_subschema_file(self):
self.assertEqual(attributetype.oid, oid)


class TestSubschemaUrlfetch(unittest.TestSuite):
class TestSubschemaUrlfetch(unittest.TestCase):
def test_urlfetch_file(self):
freeipa_uri = 'file://{}'.format(TEST_SUBSCHEMA_FILES[0])
dn, schema = ldap.schema.urlfetch(freeipa_uri)
Expand Down
8 changes: 8 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,11 @@ packager = python-ldap team
distribution_name = openSUSE 11.x
release = 1
doc_files = CHANGES README INSTALL TODO Demo/

# pytest, https://docs.pytest.org/en/latest/customize.html
[tool:pytest]
testpaths = Tests
python_files = t_*.py
filterwarnings =
error
ignore::ldap.LDAPBytesWarning

0 comments on commit 2ad72f2

Please sign in to comment.