summaryrefslogtreecommitdiff
path: root/testing/test_pdb.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2019-02-28 18:10:57 +0100
committerDaniel Hahler <git@thequod.de>2019-03-01 15:20:04 +0100
commitf7a3e001f74a53411f0ee682eed04eef0a0bfc30 (patch)
treefc3412d4ce9199d72e8979b4889e06e7f2cfbba2 /testing/test_pdb.py
parenta868a9ac13a2ac4a021a09c926b2564dccdfc70f (diff)
downloadpytest-f7a3e001f74a53411f0ee682eed04eef0a0bfc30.tar.gz
pdb: allow for --pdbclass=mod:attr.class
Diffstat (limited to 'testing/test_pdb.py')
-rw-r--r--testing/test_pdb.py17
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 """)