Skip to content

Commit d9fbe8d

Browse files
committed
Fix tests.py when passing modules instead of paths.
1 parent 9d36e98 commit d9fbe8d

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/matplotlib/__init__.py

+15-2
Original file line numberDiff line numberDiff line change
@@ -1536,8 +1536,21 @@ def test(verbosity=None, coverage=False, switch_backend_warn=True,
15361536
import pytest
15371537

15381538
args = kwargs.pop('argv', [])
1539-
if not any(os.path.exists(arg) for arg in args):
1540-
args += ['--pyargs'] + default_test_modules
1539+
provide_default_modules = True
1540+
use_pyargs = True
1541+
for arg in args:
1542+
if any(arg.startswith(module_path)
1543+
for module_path in default_test_modules):
1544+
provide_default_modules = False
1545+
break
1546+
if os.path.exists(arg):
1547+
provide_default_modules = False
1548+
use_pyargs = False
1549+
break
1550+
if use_pyargs:
1551+
args += ['--pyargs']
1552+
if provide_default_modules:
1553+
args += default_test_modules
15411554

15421555
if coverage:
15431556
args += ['--cov']

0 commit comments

Comments
 (0)