##// END OF EJS Templates
use pathlib in testing/plugin/ipdoctest.py
rushabh-v -
Show More
@@ -33,6 +33,8 b' from testpath import modified_env'
33
33
34 from inspect import getmodule
34 from inspect import getmodule
35
35
36 from pathlib import Path, PurePath
37
36 # We are overriding the default doctest runner, so we need to import a few
38 # We are overriding the default doctest runner, so we need to import a few
37 # things from doctest directly
39 # things from doctest directly
38 from doctest import (REPORTING_FLAGS, REPORT_ONLY_FIRST_FAILURE,
40 from doctest import (REPORTING_FLAGS, REPORT_ONLY_FIRST_FAILURE,
@@ -687,9 +689,8 b' class ExtensionDoctest(doctests.Doctest):'
687 yield t
689 yield t
688 else:
690 else:
689 if self.extension and anyp(filename.endswith, self.extension):
691 if self.extension and anyp(filename.endswith, self.extension):
690 name = os.path.basename(filename)
692 name = PurePath(filename).name
691 with open(filename) as dh:
693 doc = Path(filename).read_text()
692 doc = dh.read()
693 test = self.parser.get_doctest(
694 test = self.parser.get_doctest(
694 doc, globs={'__file__': filename}, name=name,
695 doc, globs={'__file__': filename}, name=name,
695 filename=filename, lineno=0)
696 filename=filename, lineno=0)
General Comments 0
You need to be logged in to leave comments. Login now