mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-31751: Do not use deprecated API in doctest runner to prevent warnings.
For 3.3+ we now use new api. We also use "-W error" in tests to make sure no warning issued GitOrigin-RevId: a668da71d8705f061873a4b2c09a4fc3f0082472
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8fd81feac0
commit
d002bd2dab
@@ -1,4 +1,3 @@
|
||||
import imp
|
||||
import sys
|
||||
import datetime
|
||||
import os
|
||||
@@ -203,6 +202,15 @@ modules = {}
|
||||
|
||||
runner = DocTestRunner()
|
||||
|
||||
|
||||
def _load_file(moduleName, fileName):
|
||||
if sys.version_info[:2] >= (3, 3):
|
||||
from importlib import machinery
|
||||
return machinery.SourceFileLoader(moduleName, fileName).load_module()
|
||||
else:
|
||||
import imp
|
||||
return imp.load_source(moduleName, fileName)
|
||||
|
||||
def loadSource(fileName):
|
||||
"""
|
||||
loads source from fileName,
|
||||
@@ -226,7 +234,7 @@ def loadSource(fileName):
|
||||
cnt += 1
|
||||
moduleName = getModuleName(prefix, cnt)
|
||||
debug("/ Loading " + fileName + " as " + moduleName)
|
||||
module = imp.load_source(moduleName, fileName)
|
||||
module = _load_file(moduleName, fileName)
|
||||
modules[moduleName] = module
|
||||
return module
|
||||
|
||||
@@ -349,4 +357,4 @@ if __name__ == "__main__":
|
||||
|
||||
debug("/ Loaded " + str(runner.countTests()) + " tests")
|
||||
TeamcityServiceMessages(sys.stdout).testCount(runner.countTests())
|
||||
runner.start()
|
||||
runner.start()
|
||||
|
||||
@@ -20,6 +20,8 @@ import com.jetbrains.python.testing.PythonTestConfigurationType;
|
||||
import com.jetbrains.python.testing.doctest.PythonDocTestRunConfiguration;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* {@link ProcessWithConsoleRunner} to run doctest
|
||||
*
|
||||
@@ -30,4 +32,10 @@ public class PyDocTestProcessRunner extends PyScriptTestProcessRunner<PythonDocT
|
||||
super(PythonTestConfigurationType.getInstance().PY_DOCTEST_FACTORY,
|
||||
PythonDocTestRunConfiguration.class, scriptName, timesToRerunFailedTests);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configurationCreatedAndWillLaunch(@NotNull final PythonDocTestRunConfiguration configuration) throws IOException {
|
||||
super.configurationCreatedAndWillLaunch(configuration);
|
||||
configuration.setInterpreterOptions(configuration.getInterpreterOptions() + " -W error");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user