Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 21f8f14 + a42464a commit 6bef27aCopy full SHA for 6bef27a
1 file changed
IPython/testing/plugin/ipdoctest.py
@@ -33,6 +33,8 @@
33
34
from inspect import getmodule
35
36
+from pathlib import Path, PurePath
37
+
38
# We are overriding the default doctest runner, so we need to import a few
39
# things from doctest directly
40
from doctest import (REPORTING_FLAGS, REPORT_ONLY_FIRST_FAILURE,
@@ -687,9 +689,8 @@ def loadTestsFromFile(self, filename):
687
689
yield t
688
690
else:
691
if self.extension and anyp(filename.endswith, self.extension):
- name = os.path.basename(filename)
- with open(filename) as dh:
692
- doc = dh.read()
+ name = PurePath(filename).name
693
+ doc = Path(filename).read_text()
694
test = self.parser.get_doctest(
695
doc, globs={'__file__': filename}, name=name,
696
filename=filename, lineno=0)
0 commit comments