Skip to content

Commit 515fb09

Browse files
committed
Move module error compatibility code to _pytest.compat
1 parent 6b24ce2 commit 515fb09

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

_pytest/compat.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
NoneType = type(None)
2727
NOTSET = object()
2828

29+
PY36 = sys.version_info[:2] >= (3, 6)
30+
MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError'
31+
2932
if hasattr(inspect, 'signature'):
3033
def _format_args(func):
3134
return str(inspect.signature(func))

testing/test_doctest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
# encoding: utf-8
22
import sys
33
import _pytest._code
4+
from _pytest.compat import MODULE_NOT_FOUND_ERROR
45
from _pytest.doctest import DoctestItem, DoctestModule, DoctestTextfile
56
import pytest
67

7-
PY36 = sys.version_info[:2] >= (3, 6)
8-
MODULE_NOT_FOUND_ERROR = 'ModuleNotFoundError' if PY36 else 'ImportError'
9-
108

119
class TestDoctests:
1210

0 commit comments

Comments
 (0)