mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Tests of case-sensitivity were being executed on OSs which did not have a
case-insensitive file system, leading to test failures. This was due to using the TestCase objects directly instead of the guard in the test_main() function. Move over to a class decorator instead to control if the tests should be run.
This commit is contained in:
parent
b0516a6bc6
commit
2c5c79cfc4
3 changed files with 13 additions and 4 deletions
|
@ -2,9 +2,11 @@ import sys
|
||||||
from test import support as test_support
|
from test import support as test_support
|
||||||
import unittest
|
import unittest
|
||||||
import importlib
|
import importlib
|
||||||
|
from .. import support
|
||||||
from . import test_path_hook
|
from . import test_path_hook
|
||||||
|
|
||||||
|
|
||||||
|
@support.case_insensitive_tests
|
||||||
class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
|
class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
|
||||||
|
|
||||||
def find_module(self):
|
def find_module(self):
|
||||||
|
@ -30,8 +32,6 @@ class ExtensionModuleCaseSensitivityTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
if sys.platform not in ('win32', 'darwin', 'cygwin'):
|
|
||||||
return
|
|
||||||
test_support.run_unittest(ExtensionModuleCaseSensitivityTest)
|
test_support.run_unittest(ExtensionModuleCaseSensitivityTest)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ from test import support as test_support
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
|
||||||
|
@support.case_insensitive_tests
|
||||||
class CaseSensitivityTest(unittest.TestCase):
|
class CaseSensitivityTest(unittest.TestCase):
|
||||||
|
|
||||||
"""PEP 235 dictates that on case-preserving, case-insensitive file systems
|
"""PEP 235 dictates that on case-preserving, case-insensitive file systems
|
||||||
|
@ -48,8 +49,6 @@ class CaseSensitivityTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
if sys.platform not in ('win32', 'darwin', 'cygwin'):
|
|
||||||
return
|
|
||||||
test_support.run_unittest(CaseSensitivityTest)
|
test_support.run_unittest(CaseSensitivityTest)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,16 @@ def writes_bytecode(fxn):
|
||||||
else:
|
else:
|
||||||
return fxn
|
return fxn
|
||||||
|
|
||||||
|
|
||||||
|
def case_insensitive_tests(class_):
|
||||||
|
"""Class decorator that nullifies tests that require a case-insensitive
|
||||||
|
file system."""
|
||||||
|
if sys.platform not in ('win32', 'darwin', 'cygwin'):
|
||||||
|
return object()
|
||||||
|
else:
|
||||||
|
return class_
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def uncache(*names):
|
def uncache(*names):
|
||||||
"""Uncache a module from sys.modules.
|
"""Uncache a module from sys.modules.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue