Skip to content

Commit

Permalink
Replace test setuptools command by unittest discover
Browse files Browse the repository at this point in the history
issue9215
review389851002
  • Loading branch information
cedk committed Apr 16, 2022
1 parent aa9c921 commit f15816c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ def get_require_version(name):
license='GPL-3',
python_requires='>=3.7',
install_requires=requires,
extras_require={
'test': tests_require,
},
dependency_links=dependency_links,
zip_safe=False,
entry_points="""
[trytond.modules]
ldap_authentication = trytond.modules.ldap_authentication
""",
test_suite='tests',
test_loader='trytond.test_loader:Loader',
tests_require=tests_require,
)
4 changes: 0 additions & 4 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

from .test_ldap_authentication import suite

__all__ = ['suite']
9 changes: 2 additions & 7 deletions tests/test_ldap_authentication.py → tests/test_module.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import unittest

from unittest.mock import ANY, patch

import ldap3

import trytond.tests.test_tryton
from trytond.config import config
from trytond.modules.ldap_authentication.res import parse_ldap_url
from trytond.pool import Pool
Expand Down Expand Up @@ -101,8 +100,4 @@ def test_parse_ldap_url(self):
{'!bindname': ['cn=Manager,o=Foo']})


def suite():
suite = trytond.tests.test_tryton.suite()
suite.addTests(unittest.TestLoader().loadTestsFromTestCase(
LDAPAuthenticationTestCase))
return suite
del ModuleTestCase
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
envlist = {py37,py38,py39,py310}-{sqlite,postgresql}

[testenv]
extras = test
commands =
coverage run --include=.*/ldap_authentication/* setup.py test
coverage run --include=.*/ldap_authentication/* -m unittest discover -s tests
coverage report --include=.*/ldap_authentication/* --omit=*/tests/*
deps =
coverage
Expand Down

0 comments on commit f15816c

Please sign in to comment.