diff options
author | Daniel Hahler <git@thequod.de> | 2019-02-28 18:10:57 +0100 |
---|---|---|
committer | Daniel Hahler <git@thequod.de> | 2019-03-01 15:20:04 +0100 |
commit | f7a3e001f74a53411f0ee682eed04eef0a0bfc30 (patch) | |
tree | fc3412d4ce9199d72e8979b4889e06e7f2cfbba2 /testing/test_pdb.py | |
parent | a868a9ac13a2ac4a021a09c926b2564dccdfc70f (diff) | |
download | pytest-f7a3e001f74a53411f0ee682eed04eef0a0bfc30.tar.gz |
pdb: allow for --pdbclass=mod:attr.class
Diffstat (limited to 'testing/test_pdb.py')
-rw-r--r-- | testing/test_pdb.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/testing/test_pdb.py b/testing/test_pdb.py index f0cef2788..f9a050b10 100644 --- a/testing/test_pdb.py +++ b/testing/test_pdb.py @@ -2,12 +2,14 @@ from __future__ import absolute_import from __future__ import division from __future__ import print_function +import argparse import os import platform import sys import _pytest._code import pytest +from _pytest.debugging import _validate_usepdb_cls try: breakpoint @@ -695,12 +697,15 @@ class TestPDB(object): "*: error: argument --pdbcls: 'invalid' is not in the format 'modname:classname'" ] ) - result = testdir.runpytest_inprocess("--pdbcls=pdb:DoesNotExist") - result.stderr.fnmatch_lines( - [ - "*: error: argument --pdbcls: could not get pdb class for 'pdb:DoesNotExist':*" - ] - ) + + def test_pdb_validate_usepdb_cls(self, testdir): + assert _validate_usepdb_cls("os.path:dirname.__name__") == "dirname" + + with pytest.raises( + argparse.ArgumentTypeError, + match=r"^could not get pdb class for 'pdb:DoesNotExist': .*'DoesNotExist'", + ): + _validate_usepdb_cls("pdb:DoesNotExist") def test_pdb_custom_cls_without_pdb(self, testdir, custom_pdb_calls): p1 = testdir.makepyfile("""xxx """) |