From d23173b76e7b070ee7b4a062e4269430d07083fb Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Thu, 15 Dec 2022 21:43:01 -0800 Subject: [PATCH 1/7] Switching python unittest to pytest framework This change may also have a small naming requirement as we can see in the pyproject.toml. It prompted me to change the helper function name from test_percent_1000() to helper_test_percent_1000 since pytest config will now discover every functions starting with test_*. However, I thought it may still be worth the switch for possible pytest features we can leverage down the road. Just wanted to see what the thought is on switching and the changes in config. May need to change the docs/guides/contributing/unit_tests.rst to reflect this config change as well. Signed-off-by: Mei Chu --- pyproject.toml | 5 + tests/python/ColorSpaceTest.py | 16 ++-- tests/python/MixingHelpersTest.py | 134 +++++++++++++-------------- tests/python/OpenColorIOTestSuite.py | 117 +---------------------- tests/python/TransformsTest.py | 6 +- tests/python/requirements.txt | 1 + 6 files changed, 87 insertions(+), 192 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 69672a6df7..54ce17982f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,3 +32,8 @@ before-build = "share/ci/scripts/macos/install_docs_env.sh" [tool.cibuildwheel.windows] before-build = "bash -c share/ci/scripts/windows/install_docs_env.sh" + +[tool.pytest.ini_options] +python_files = "*Test.py" +python_classes = "Test" +python_functions = "test_*" \ No newline at end of file diff --git a/tests/python/ColorSpaceTest.py b/tests/python/ColorSpaceTest.py index 465539886c..6567fc77ea 100644 --- a/tests/python/ColorSpaceTest.py +++ b/tests/python/ColorSpaceTest.py @@ -348,7 +348,7 @@ def test_transform(self): self.colorspace.setTransform(self.log_tr, direction) log_transform = self.colorspace.getTransform(direction) self.assertIsInstance(log_transform, OCIO.LogTransform) - self.assertEquals(self.log_tr.getBase(), log_transform.getBase()) + self.assertEqual(self.log_tr.getBase(), log_transform.getBase()) def test_aliases(self): """ @@ -446,7 +446,7 @@ def test_is_colorspace_linear(self): name: display_data description: | Data space. - Has a linear transform, which should never happen, but this will be ignored since + Has a linear transform, which should never happen, but this will be ignored since isdata is true. isdata: true encoding: data @@ -501,7 +501,7 @@ def test_is_colorspace_linear(self): name: scene_data description: | Data space. - Has a linear transform, which should never happen, but this will be ignored + Has a linear transform, which should never happen, but this will be ignored since isdata is true. isdata: true encoding: data @@ -559,14 +559,14 @@ def test_is_colorspace_linear(self): description: | No encoding. Considered linear since it is equivalent to the reference space. isdata: false -""" +""" # Create a config. cfg = OCIO.Config.CreateFromStream(SIMPLE_PROFILE) def test_scene_referred(self, cfg, cs_name, expected_value): cs = cfg.getColorSpace(cs_name) is_linear_to_scene_reference = cfg.isColorSpaceLinear( - cs_name, + cs_name, OCIO.REFERENCE_SPACE_SCENE ) self.assertEqual(is_linear_to_scene_reference, expected_value) @@ -574,7 +574,7 @@ def test_scene_referred(self, cfg, cs_name, expected_value): def test_display_referred(self, cfg, cs_name, expected_value): cs = cfg.getColorSpace(cs_name) is_linear_to_display_reference = cfg.isColorSpaceLinear( - cs_name, + cs_name, OCIO.REFERENCE_SPACE_DISPLAY ) self.assertEqual(is_linear_to_display_reference, expected_value) @@ -618,9 +618,9 @@ def test_display_referred(self, cfg, cs_name, expected_value): test_display_referred(self, cfg, "scene_nonlin-trans", False) test_display_referred(self, cfg, "scene_linear-trans-alias", False) test_display_referred(self, cfg, "scene_ref", False) - + def test_processor_to_known_colorspace(self): - + CONFIG = """ocio_profile_version: 2 roles: diff --git a/tests/python/MixingHelpersTest.py b/tests/python/MixingHelpersTest.py index 7eda05d61c..419831879b 100644 --- a/tests/python/MixingHelpersTest.py +++ b/tests/python/MixingHelpersTest.py @@ -8,7 +8,7 @@ import PyOpenColorIO as OCIO from UnitTestUtils import SAMPLE_CONFIG -def test_percent_1000(a, b): +def helper_test_percent_1000(a, b): # Helper function to test sliders. return abs(a - int(100000 * b)) <= 1 @@ -187,7 +187,7 @@ def test_get_processor(self): def test_color_picking(self): """ - Test getProcessor() function with ROLE_COLOR_PICKING role. + Test getProcessor() function with ROLE_COLOR_PICKING role. """ mix = OCIO.MixingColorSpaceManager(self.cfg) mixSpaces = mix.getMixingSpaces() @@ -254,27 +254,27 @@ def test_mixing_slider(self): slider.setSliderMinEdge(0.0) slider.setSliderMaxEdge(1.0) - self.assertTrue(test_percent_1000( 0, slider.getSliderMinEdge())) - self.assertTrue(test_percent_1000(83386, slider.getSliderMaxEdge())) + self.assertTrue(helper_test_percent_1000( 0, slider.getSliderMinEdge())) + self.assertTrue(helper_test_percent_1000(83386, slider.getSliderMaxEdge())) - self.assertTrue(test_percent_1000(37923, slider.mixingToSlider(mixingUnits=0.1))) - self.assertTrue(test_percent_1000(80144, slider.mixingToSlider(0.5))) + self.assertTrue(helper_test_percent_1000(37923, slider.mixingToSlider(mixingUnits=0.1))) + self.assertTrue(helper_test_percent_1000(80144, slider.mixingToSlider(0.5))) - self.assertTrue(test_percent_1000(10000, slider.sliderToMixing(sliderUnits=0.379232))) - self.assertTrue(test_percent_1000(50000, slider.sliderToMixing(0.801448))) + self.assertTrue(helper_test_percent_1000(10000, slider.sliderToMixing(sliderUnits=0.379232))) + self.assertTrue(helper_test_percent_1000(50000, slider.sliderToMixing(0.801448))) slider.setSliderMinEdge(-0.2) slider.setSliderMaxEdge(5.) - self.assertTrue(test_percent_1000( 3792, slider.mixingToSlider(-0.1))) - self.assertTrue(test_percent_1000(31573, slider.mixingToSlider( 0.1))) - self.assertTrue(test_percent_1000(58279, slider.mixingToSlider( 0.5))) - self.assertTrue(test_percent_1000(90744, slider.mixingToSlider( 3.0))) + self.assertTrue(helper_test_percent_1000( 3792, slider.mixingToSlider(-0.1))) + self.assertTrue(helper_test_percent_1000(31573, slider.mixingToSlider( 0.1))) + self.assertTrue(helper_test_percent_1000(58279, slider.mixingToSlider( 0.5))) + self.assertTrue(helper_test_percent_1000(90744, slider.mixingToSlider( 3.0))) - self.assertTrue(test_percent_1000(-10000, slider.sliderToMixing(0.037927))) - self.assertTrue(test_percent_1000( 10000, slider.sliderToMixing(0.315733))) - self.assertTrue(test_percent_1000( 50000, slider.sliderToMixing(0.582797))) - self.assertTrue(test_percent_1000(300000, slider.sliderToMixing(0.907444))) + self.assertTrue(helper_test_percent_1000(-10000, slider.sliderToMixing(0.037927))) + self.assertTrue(helper_test_percent_1000( 10000, slider.sliderToMixing(0.315733))) + self.assertTrue(helper_test_percent_1000( 50000, slider.sliderToMixing(0.582797))) + self.assertTrue(helper_test_percent_1000(300000, slider.sliderToMixing(0.907444))) # Does not need any linear to perceptually linear adjustment. @@ -286,63 +286,63 @@ def test_mixing_slider(self): slider.setSliderMinEdge(0.0) slider.setSliderMaxEdge(1.0) - self.assertTrue(test_percent_1000( 0, slider.getSliderMinEdge())) - self.assertTrue(test_percent_1000(100000, slider.getSliderMaxEdge())) + self.assertTrue(helper_test_percent_1000( 0, slider.getSliderMinEdge())) + self.assertTrue(helper_test_percent_1000(100000, slider.getSliderMaxEdge())) - self.assertTrue(test_percent_1000(10000, slider.mixingToSlider(0.1))) - self.assertTrue(test_percent_1000(50000, slider.mixingToSlider(0.5))) + self.assertTrue(helper_test_percent_1000(10000, slider.mixingToSlider(0.1))) + self.assertTrue(helper_test_percent_1000(50000, slider.mixingToSlider(0.5))) - self.assertTrue(test_percent_1000(37923, slider.sliderToMixing(0.379232))) - self.assertTrue(test_percent_1000(80144, slider.sliderToMixing(0.801448))) + self.assertTrue(helper_test_percent_1000(37923, slider.sliderToMixing(0.379232))) + self.assertTrue(helper_test_percent_1000(80144, slider.sliderToMixing(0.801448))) slider.setSliderMinEdge(-0.2) slider.setSliderMaxEdge(5.) - self.assertTrue(test_percent_1000( 0, slider.mixingToSlider(slider.getSliderMinEdge()))) - self.assertTrue(test_percent_1000(100000, slider.mixingToSlider(slider.getSliderMaxEdge()))) + self.assertTrue(helper_test_percent_1000( 0, slider.mixingToSlider(slider.getSliderMinEdge()))) + self.assertTrue(helper_test_percent_1000(100000, slider.mixingToSlider(slider.getSliderMaxEdge()))) - self.assertTrue(test_percent_1000( 1923, slider.mixingToSlider(-0.1))) - self.assertTrue(test_percent_1000( 5769, slider.mixingToSlider( 0.1))) - self.assertTrue(test_percent_1000(13461, slider.mixingToSlider( 0.5))) - self.assertTrue(test_percent_1000(61538, slider.mixingToSlider( 3.0))) + self.assertTrue(helper_test_percent_1000( 1923, slider.mixingToSlider(-0.1))) + self.assertTrue(helper_test_percent_1000( 5769, slider.mixingToSlider( 0.1))) + self.assertTrue(helper_test_percent_1000(13461, slider.mixingToSlider( 0.5))) + self.assertTrue(helper_test_percent_1000(61538, slider.mixingToSlider( 3.0))) - self.assertTrue(test_percent_1000( -277, slider.sliderToMixing(0.037927))) - self.assertTrue(test_percent_1000(144181, slider.sliderToMixing(0.315733))) - self.assertTrue(test_percent_1000(283054, slider.sliderToMixing(0.582797))) - self.assertTrue(test_percent_1000(451870, slider.sliderToMixing(0.907444))) + self.assertTrue(helper_test_percent_1000( -277, slider.sliderToMixing(0.037927))) + self.assertTrue(helper_test_percent_1000(144181, slider.sliderToMixing(0.315733))) + self.assertTrue(helper_test_percent_1000(283054, slider.sliderToMixing(0.582797))) + self.assertTrue(helper_test_percent_1000(451870, slider.sliderToMixing(0.907444))) # Change encoding. mix.setSelectedMixingEncodingIdx(0) # i.e. RGB # Needs linear to perceptually linear adjustment. - + mix.setSelectedMixingSpaceIdx(0) # i.e. Rendering Space slider.setSliderMinEdge(0.0) slider.setSliderMaxEdge(1.0) - self.assertTrue(test_percent_1000( 0, slider.getSliderMinEdge())) - self.assertTrue(test_percent_1000(83386, slider.getSliderMaxEdge())) + self.assertTrue(helper_test_percent_1000( 0, slider.getSliderMinEdge())) + self.assertTrue(helper_test_percent_1000(83386, slider.getSliderMaxEdge())) - self.assertTrue(test_percent_1000(37923, slider.mixingToSlider(0.1))) - self.assertTrue(test_percent_1000(80144, slider.mixingToSlider(0.5))) + self.assertTrue(helper_test_percent_1000(37923, slider.mixingToSlider(0.1))) + self.assertTrue(helper_test_percent_1000(80144, slider.mixingToSlider(0.5))) - self.assertTrue(test_percent_1000(10000, slider.sliderToMixing(0.379232))) - self.assertTrue(test_percent_1000(50000, slider.sliderToMixing(0.801448))) + self.assertTrue(helper_test_percent_1000(10000, slider.sliderToMixing(0.379232))) + self.assertTrue(helper_test_percent_1000(50000, slider.sliderToMixing(0.801448))) slider.setSliderMinEdge(-0.2) slider.setSliderMaxEdge(5.) - self.assertTrue(test_percent_1000( 3792, slider.mixingToSlider(-0.1))) - self.assertTrue(test_percent_1000(31573, slider.mixingToSlider( 0.1))) - self.assertTrue(test_percent_1000(58279, slider.mixingToSlider( 0.5))) - self.assertTrue(test_percent_1000(90744, slider.mixingToSlider( 3.0))) + self.assertTrue(helper_test_percent_1000( 3792, slider.mixingToSlider(-0.1))) + self.assertTrue(helper_test_percent_1000(31573, slider.mixingToSlider( 0.1))) + self.assertTrue(helper_test_percent_1000(58279, slider.mixingToSlider( 0.5))) + self.assertTrue(helper_test_percent_1000(90744, slider.mixingToSlider( 3.0))) - self.assertTrue(test_percent_1000(-10000, slider.sliderToMixing(0.037927))) - self.assertTrue(test_percent_1000( 10000, slider.sliderToMixing(0.315733))) - self.assertTrue(test_percent_1000( 50000, slider.sliderToMixing(0.582797))) - self.assertTrue(test_percent_1000(300000, slider.sliderToMixing(0.907444))) + self.assertTrue(helper_test_percent_1000(-10000, slider.sliderToMixing(0.037927))) + self.assertTrue(helper_test_percent_1000( 10000, slider.sliderToMixing(0.315733))) + self.assertTrue(helper_test_percent_1000( 50000, slider.sliderToMixing(0.582797))) + self.assertTrue(helper_test_percent_1000(300000, slider.sliderToMixing(0.907444))) # Does not need any linear to perceptually linear adjustment. @@ -351,30 +351,30 @@ def test_mixing_slider(self): slider.setSliderMinEdge(0.0) slider.setSliderMaxEdge(1.0) - self.assertTrue(test_percent_1000( 0, slider.getSliderMinEdge())) - self.assertTrue(test_percent_1000(100000, slider.getSliderMaxEdge())) + self.assertTrue(helper_test_percent_1000( 0, slider.getSliderMinEdge())) + self.assertTrue(helper_test_percent_1000(100000, slider.getSliderMaxEdge())) - self.assertTrue(test_percent_1000(10000, slider.mixingToSlider(0.1))) - self.assertTrue(test_percent_1000(50000, slider.mixingToSlider(0.5))) + self.assertTrue(helper_test_percent_1000(10000, slider.mixingToSlider(0.1))) + self.assertTrue(helper_test_percent_1000(50000, slider.mixingToSlider(0.5))) - self.assertTrue(test_percent_1000(37923, slider.sliderToMixing(0.379232))) - self.assertTrue(test_percent_1000(80144, slider.sliderToMixing(0.801448))) + self.assertTrue(helper_test_percent_1000(37923, slider.sliderToMixing(0.379232))) + self.assertTrue(helper_test_percent_1000(80144, slider.sliderToMixing(0.801448))) slider.setSliderMinEdge(-0.2) slider.setSliderMaxEdge(5.) - self.assertTrue(test_percent_1000( 0, slider.mixingToSlider(slider.getSliderMinEdge()))) - self.assertTrue(test_percent_1000(100000, slider.mixingToSlider(slider.getSliderMaxEdge()))) + self.assertTrue(helper_test_percent_1000( 0, slider.mixingToSlider(slider.getSliderMinEdge()))) + self.assertTrue(helper_test_percent_1000(100000, slider.mixingToSlider(slider.getSliderMaxEdge()))) - self.assertTrue(test_percent_1000( 1923, slider.mixingToSlider(-0.1))) - self.assertTrue(test_percent_1000( 5769, slider.mixingToSlider( 0.1))) - self.assertTrue(test_percent_1000(13461, slider.mixingToSlider( 0.5))) - self.assertTrue(test_percent_1000(61538, slider.mixingToSlider( 3.0))) + self.assertTrue(helper_test_percent_1000( 1923, slider.mixingToSlider(-0.1))) + self.assertTrue(helper_test_percent_1000( 5769, slider.mixingToSlider( 0.1))) + self.assertTrue(helper_test_percent_1000(13461, slider.mixingToSlider( 0.5))) + self.assertTrue(helper_test_percent_1000(61538, slider.mixingToSlider( 3.0))) - self.assertTrue(test_percent_1000( -277, slider.sliderToMixing(0.037927))) - self.assertTrue(test_percent_1000(144181, slider.sliderToMixing(0.315733))) - self.assertTrue(test_percent_1000(283054, slider.sliderToMixing(0.582797))) - self.assertTrue(test_percent_1000(451870, slider.sliderToMixing(0.907444))) + self.assertTrue(helper_test_percent_1000( -277, slider.sliderToMixing(0.037927))) + self.assertTrue(helper_test_percent_1000(144181, slider.sliderToMixing(0.315733))) + self.assertTrue(helper_test_percent_1000(283054, slider.sliderToMixing(0.582797))) + self.assertTrue(helper_test_percent_1000(451870, slider.sliderToMixing(0.907444))) # Update with ROLE_COLOR_PICKING role. @@ -385,14 +385,14 @@ def test_mixing_slider(self): mix.setSelectedMixingSpaceIdx(0) # i.e. Color Picker role slider = mix.getSlider(0.0, 1.0) - self.assertTrue(test_percent_1000(50501, slider.mixingToSlider(0.50501))) - self.assertTrue(test_percent_1000(50501, slider.sliderToMixing(0.50501))) + self.assertTrue(helper_test_percent_1000(50501, slider.mixingToSlider(0.50501))) + self.assertTrue(helper_test_percent_1000(50501, slider.sliderToMixing(0.50501))) mix.setSelectedMixingEncodingIdx(0) # i.e. RGB mix.setSelectedMixingSpaceIdx(0) # i.e. Color Picker role - self.assertTrue(test_percent_1000(50501, slider.mixingToSlider(0.50501))) - self.assertTrue(test_percent_1000(50501, slider.sliderToMixing(0.50501))) + self.assertTrue(helper_test_percent_1000(50501, slider.mixingToSlider(0.50501))) + self.assertTrue(helper_test_percent_1000(50501, slider.sliderToMixing(0.50501))) mix = None diff --git a/tests/python/OpenColorIOTestSuite.py b/tests/python/OpenColorIOTestSuite.py index a9aaa5c930..a249946f82 100755 --- a/tests/python/OpenColorIOTestSuite.py +++ b/tests/python/OpenColorIOTestSuite.py @@ -2,7 +2,7 @@ # Copyright Contributors to the OpenColorIO Project. import logging -import unittest +import pytest import os import sys @@ -44,118 +44,7 @@ os.environ["TEST_DATAFILES_DIR"] = os.path.join(here, 'data', 'files') sys.path.insert(0, here) -import PyOpenColorIO as OCIO - -import AllocationTransformTest -import BakerTest -import BuiltinConfigRegistryTest -import BuiltinTransformRegistryTest -import BuiltinTransformTest -import CDLTransformTest -import ColorSpaceHelpersTest -import ColorSpaceTest -import ColorSpaceTransformTest -import ConfigTest -import ConstantsTest -import ContextTest -import CPUProcessorTest -import DisplayViewHelpersTest -import DisplayViewTransformTest -import ExponentTransformTest -import ExponentWithLinearTransformTest -import ExposureContrastTransformTest -import FileRulesTest -import FileTransformTest -import FixedFunctionTransformTest -import FormatMetadataTest -import GpuShaderDescTest -import GradingDataTest -import GradingPrimaryTransformTest -import GradingRGBCurveTransformTest -import GradingToneTransformTest -import GroupTransformTest -import LegacyViewingPipelineTest -import LogCameraTransformTest -import LogTransformTest -import LookTest -import LookTransformTest -import Lut1DTransformTest -import Lut3DTransformTest -import MatrixTransformTest -import MixingHelpersTest -import NamedTransformTest -import OCIOZArchiveTest -import OpenColorIOTest -import ProcessorTest -import RangeTransformTest -import TransformsTest -import ViewingRulesTest -import ViewTransformTest - -def suite(): - """Load unittest.TestCase objects from *Test.py files within ./tests/Python - - :return: unittest test suite of TestCase objects. - :rtype: unittest.TestSuite - """ - - # top level directory cached on loader instance - suite = unittest.TestSuite() - loader = unittest.TestLoader() - - suite.addTest(loader.loadTestsFromModule(AllocationTransformTest)) - suite.addTest(loader.loadTestsFromModule(BakerTest)) - suite.addTest(loader.loadTestsFromModule(BuiltinConfigRegistryTest)) - suite.addTest(loader.loadTestsFromModule(BuiltinTransformRegistryTest)) - suite.addTest(loader.loadTestsFromModule(BuiltinTransformTest)) - suite.addTest(loader.loadTestsFromModule(CDLTransformTest)) - suite.addTest(loader.loadTestsFromModule(ColorSpaceHelpersTest)) - suite.addTest(loader.loadTestsFromModule(ColorSpaceTest)) - suite.addTest(loader.loadTestsFromModule(ColorSpaceTransformTest)) - suite.addTest(loader.loadTestsFromModule(ConfigTest)) - suite.addTest(loader.loadTestsFromModule(ConstantsTest)) - suite.addTest(loader.loadTestsFromModule(ContextTest)) - suite.addTest(loader.loadTestsFromModule(CPUProcessorTest)) - suite.addTest(loader.loadTestsFromModule(DisplayViewHelpersTest)) - suite.addTest(loader.loadTestsFromModule(DisplayViewTransformTest)) - suite.addTest(loader.loadTestsFromModule(ExponentTransformTest)) - suite.addTest(loader.loadTestsFromModule(ExponentWithLinearTransformTest)) - suite.addTest(loader.loadTestsFromModule(ExposureContrastTransformTest)) - suite.addTest(loader.loadTestsFromModule(FileTransformTest)) - suite.addTest(loader.loadTestsFromModule(FileRulesTest)) - suite.addTest(loader.loadTestsFromModule(FixedFunctionTransformTest)) - suite.addTest(loader.loadTestsFromModule(FormatMetadataTest)) - suite.addTest(loader.loadTestsFromModule(GpuShaderDescTest)) - suite.addTest(loader.loadTestsFromModule(GradingDataTest)) - suite.addTest(loader.loadTestsFromModule(GradingPrimaryTransformTest)) - suite.addTest(loader.loadTestsFromModule(GradingRGBCurveTransformTest)) - suite.addTest(loader.loadTestsFromModule(GradingToneTransformTest)) - suite.addTest(loader.loadTestsFromModule(GroupTransformTest)) - suite.addTest(loader.loadTestsFromModule(LegacyViewingPipelineTest)) - suite.addTest(loader.loadTestsFromModule(LogCameraTransformTest)) - suite.addTest(loader.loadTestsFromModule(LogTransformTest)) - suite.addTest(loader.loadTestsFromModule(LookTest)) - suite.addTest(loader.loadTestsFromModule(LookTransformTest)) - suite.addTest(loader.loadTestsFromModule(Lut1DTransformTest)) - suite.addTest(loader.loadTestsFromModule(Lut3DTransformTest)) - suite.addTest(loader.loadTestsFromModule(MatrixTransformTest)) - suite.addTest(loader.loadTestsFromModule(MixingHelpersTest)) - suite.addTest(loader.loadTestsFromModule(NamedTransformTest)) - suite.addTest(loader.loadTestsFromModule(OCIOZArchiveTest)) - suite.addTest(loader.loadTestsFromModule(OpenColorIOTest)) - suite.addTest(loader.loadTestsFromModule(ProcessorTest)) - suite.addTest(loader.loadTestsFromModule(RangeTransformTest)) - suite.addTest(loader.loadTestsFromModule(TransformsTest)) - suite.addTest(loader.loadTestsFromModule(ViewingRulesTest)) - suite.addTest(loader.loadTestsFromModule(ViewTransformTest)) - - return suite - if __name__ == '__main__': - runner = unittest.TextTestRunner(verbosity=2) - test_suite = suite() - result = runner.run(test_suite) - if result.wasSuccessful() == False: - sys.exit(1) - sys.exit(0) + exit_code = pytest.main([os.path.dirname(__file__)]) + sys.exit(exit_code) diff --git a/tests/python/TransformsTest.py b/tests/python/TransformsTest.py index d4b1b35962..8a02e234e7 100644 --- a/tests/python/TransformsTest.py +++ b/tests/python/TransformsTest.py @@ -48,14 +48,14 @@ def test_copy(self): other = copy.deepcopy(transform) self.assertFalse(other is transform) - self.assertEquals(other.getTransformType(), transform.getTransformType()) - self.assertEquals(other.getDirection(), transform.getDirection()) + self.assertEqual(other.getTransformType(), transform.getTransformType()) + self.assertEqual(other.getDirection(), transform.getDirection()) # Not all OCIO.Transform have equals methods if hasattr(transform, 'equals'): self.assertTrue(other.equals(transform)) other.setDirection(OCIO.TRANSFORM_DIR_INVERSE) - self.assertNotEquals(other.getDirection(), transform.getDirection()) + self.assertNotEqual(other.getDirection(), transform.getDirection()) def test_binding_group_polymorphism(self): """ diff --git a/tests/python/requirements.txt b/tests/python/requirements.txt index 24ce15ab7e..1cc18fc792 100644 --- a/tests/python/requirements.txt +++ b/tests/python/requirements.txt @@ -1 +1,2 @@ numpy +pytest From b94df2c882c94a3a5e71da37717227269f769713 Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Thu, 15 Dec 2022 22:33:25 -0800 Subject: [PATCH 2/7] Adding more pytest options into pyproject.toml. Signed-off-by: Mei Chu --- pyproject.toml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 54ce17982f..7beeca0879 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta" build-verbosity = "1" test-command = "python -m PyOpenColorIOTests.OpenColorIOTestSuite" -test-requires = ["numpy"] +test-requires = ["numpy", "pytest"] manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" @@ -36,4 +36,6 @@ before-build = "bash -c share/ci/scripts/windows/install_docs_env.sh" [tool.pytest.ini_options] python_files = "*Test.py" python_classes = "Test" -python_functions = "test_*" \ No newline at end of file +python_functions = "test_*" +addopts = ["--disable-warnings"] +testpaths = ["tests/python"] \ No newline at end of file From 1d86e1ed69112ac16d780d3a85ccdd4faac70652 Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Thu, 15 Dec 2022 23:17:27 -0800 Subject: [PATCH 3/7] -Set minimum version of pytest to 6 to support myproject.toml. Signed-off-by: Mei Chu --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 7beeca0879..dc11e36ebf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ before-build = "share/ci/scripts/macos/install_docs_env.sh" before-build = "bash -c share/ci/scripts/windows/install_docs_env.sh" [tool.pytest.ini_options] +minversion = "6.0" python_files = "*Test.py" python_classes = "Test" python_functions = "test_*" From 6d9e3c8c97b4c27f7566204d4e2d8656de706765 Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Thu, 15 Dec 2022 23:29:45 -0800 Subject: [PATCH 4/7] - Added pytest.ini as an older pytest config file. Signed-off-by: Mei Chu --- pyproject.toml | 2 +- pytest.ini | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index dc11e36ebf..4b47dc0660 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta" build-verbosity = "1" test-command = "python -m PyOpenColorIOTests.OpenColorIOTestSuite" -test-requires = ["numpy", "pytest"] +test-requires = ["numpy"] manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000000..c7e86c2f30 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,11 @@ +# TODO: To be removed after python 2 is no longer being used by this project. +# This is a temporary but necessary pytest config file to be replaced by pyproject.toml. + +[pytest] +minversion = 6.0 +addopts = --disable-warnings +python_files = *Test.py +python_classes = Test +python_functions = test_* +testpaths = + tests/python \ No newline at end of file From 293ac1189065206d5709e5966e73ab1f4b11c2b3 Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Thu, 15 Dec 2022 23:39:10 -0800 Subject: [PATCH 5/7] -Removed pytest version requirement because python2 support is dropped before pytest version 5. Signed-off-by: Mei Chu --- pyproject.toml | 1 - pytest.ini | 1 - 2 files changed, 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4b47dc0660..251a668290 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,6 @@ before-build = "share/ci/scripts/macos/install_docs_env.sh" before-build = "bash -c share/ci/scripts/windows/install_docs_env.sh" [tool.pytest.ini_options] -minversion = "6.0" python_files = "*Test.py" python_classes = "Test" python_functions = "test_*" diff --git a/pytest.ini b/pytest.ini index c7e86c2f30..b177224462 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,7 +2,6 @@ # This is a temporary but necessary pytest config file to be replaced by pyproject.toml. [pytest] -minversion = 6.0 addopts = --disable-warnings python_files = *Test.py python_classes = Test From c3845328f2590b79808f92caa1cf873c644c50db Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Fri, 16 Dec 2022 01:11:42 -0800 Subject: [PATCH 6/7] -Add pytest to wheel test requirement. Signed-off-by: Mei Chu --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 251a668290..7beeca0879 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,7 @@ build-backend = "setuptools.build_meta" build-verbosity = "1" test-command = "python -m PyOpenColorIOTests.OpenColorIOTestSuite" -test-requires = ["numpy"] +test-requires = ["numpy", "pytest"] manylinux-x86_64-image = "manylinux2014" manylinux-i686-image = "manylinux2014" From 7c9d6ab5e30792e297af974acb9572224abe8348 Mon Sep 17 00:00:00 2001 From: Mei Chu Date: Fri, 13 Jan 2023 22:18:39 -0800 Subject: [PATCH 7/7] -Remove pytest.ini. -Remove pytest component of pyproject.toml. -Conform tests to pytest naming convention. Signed-off-by: Mei Chu --- pyproject.toml | 7 - pytest.ini | 10 - ...ormTest.py => test_AllocationTransform.py} | 4 +- tests/python/{BakerTest.py => test_Baker.py} | 2 +- ...yTest.py => test_BuiltinConfigRegistry.py} | 18 +- ...nsformTest.py => test_BuiltinTransform.py} | 12 +- ...st.py => test_BuiltinTransformRegistry.py} | 12 +- ...LTransformTest.py => test_CDLTransform.py} | 4 +- ...UProcessorTest.py => test_CPUProcessor.py} | 202 +++++++++--------- .../{ColorSpaceTest.py => test_ColorSpace.py} | 2 +- ...lpersTest.py => test_ColorSpaceHelpers.py} | 4 +- ...ormTest.py => test_ColorSpaceTransform.py} | 4 +- .../python/{ConfigTest.py => test_Config.py} | 26 +-- .../{ConstantsTest.py => test_Constants.py} | 2 +- .../{ContextTest.py => test_Context.py} | 2 +- ...persTest.py => test_DisplayViewHelpers.py} | 2 +- ...rmTest.py => test_DisplayViewTransform.py} | 4 +- ...sformTest.py => test_ExponentTransform.py} | 4 +- ...py => test_ExponentWithLinearTransform.py} | 4 +- ...t.py => test_ExposureContrastTransform.py} | 4 +- .../{FileRulesTest.py => test_FileRules.py} | 2 +- ...TransformTest.py => test_FileTransform.py} | 4 +- ...Test.py => test_FixedFunctionTransform.py} | 4 +- ...MetadataTest.py => test_FormatMetadata.py} | 2 +- ...haderDescTest.py => test_GpuShaderDesc.py} | 16 +- ...GradingDataTest.py => test_GradingData.py} | 6 +- ...est.py => test_GradingPrimaryTransform.py} | 2 +- ...st.py => test_GradingRGBCurveTransform.py} | 8 +- ...rmTest.py => test_GradingToneTransform.py} | 2 +- ...ransformTest.py => test_GroupTransform.py} | 4 +- ...eTest.py => test_LegacyViewingPipeline.py} | 2 +- ...formTest.py => test_LogCameraTransform.py} | 7 +- ...gTransformTest.py => test_LogTransform.py} | 4 +- tests/python/{LookTest.py => test_Look.py} | 2 +- ...TransformTest.py => test_LookTransform.py} | 4 +- ...ransformTest.py => test_Lut1DTransform.py} | 4 +- ...ransformTest.py => test_Lut3DTransform.py} | 4 +- ...ansformTest.py => test_MatrixTransform.py} | 2 +- ...ngHelpersTest.py => test_MixingHelpers.py} | 2 +- ...ransformTest.py => test_NamedTransform.py} | 4 +- ...IOZArchiveTest.py => test_OCIOZArchive.py} | 34 +-- ...OpenColorIOTest.py => test_OpenColorIO.py} | 2 +- .../{ProcessorTest.py => test_Processor.py} | 2 +- ...ransformTest.py => test_RangeTransform.py} | 3 +- .../{TransformsTest.py => test_Transforms.py} | 2 +- ...ormsBaseTest.py => test_TransformsBase.py} | 0 ...TransformTest.py => test_ViewTransform.py} | 2 +- ...ewingRulesTest.py => test_ViewingRules.py} | 2 +- 48 files changed, 221 insertions(+), 240 deletions(-) delete mode 100644 pytest.ini rename tests/python/{AllocationTransformTest.py => test_AllocationTransform.py} (97%) rename tests/python/{BakerTest.py => test_Baker.py} (99%) rename tests/python/{BuiltinConfigRegistryTest.py => test_BuiltinConfigRegistry.py} (96%) rename tests/python/{BuiltinTransformTest.py => test_BuiltinTransform.py} (89%) rename tests/python/{BuiltinTransformRegistryTest.py => test_BuiltinTransformRegistry.py} (96%) rename tests/python/{CDLTransformTest.py => test_CDLTransform.py} (96%) rename tests/python/{CPUProcessorTest.py => test_CPUProcessor.py} (81%) rename tests/python/{ColorSpaceTest.py => test_ColorSpace.py} (99%) rename tests/python/{ColorSpaceHelpersTest.py => test_ColorSpaceHelpers.py} (99%) rename tests/python/{ColorSpaceTransformTest.py => test_ColorSpaceTransform.py} (96%) rename tests/python/{ConfigTest.py => test_Config.py} (99%) rename tests/python/{ConstantsTest.py => test_Constants.py} (98%) rename tests/python/{ContextTest.py => test_Context.py} (98%) rename tests/python/{DisplayViewHelpersTest.py => test_DisplayViewHelpers.py} (99%) rename tests/python/{DisplayViewTransformTest.py => test_DisplayViewTransform.py} (98%) rename tests/python/{ExponentTransformTest.py => test_ExponentTransform.py} (97%) rename tests/python/{ExponentWithLinearTransformTest.py => test_ExponentWithLinearTransform.py} (98%) rename tests/python/{ExposureContrastTransformTest.py => test_ExposureContrastTransform.py} (98%) rename tests/python/{FileRulesTest.py => test_FileRules.py} (99%) rename tests/python/{FileTransformTest.py => test_FileTransform.py} (98%) rename tests/python/{FixedFunctionTransformTest.py => test_FixedFunctionTransform.py} (98%) rename tests/python/{FormatMetadataTest.py => test_FormatMetadata.py} (99%) rename tests/python/{GpuShaderDescTest.py => test_GpuShaderDesc.py} (96%) rename tests/python/{GradingDataTest.py => test_GradingData.py} (99%) rename tests/python/{GradingPrimaryTransformTest.py => test_GradingPrimaryTransform.py} (99%) rename tests/python/{GradingRGBCurveTransformTest.py => test_GradingRGBCurveTransform.py} (97%) rename tests/python/{GradingToneTransformTest.py => test_GradingToneTransform.py} (99%) rename tests/python/{GroupTransformTest.py => test_GroupTransform.py} (98%) rename tests/python/{LegacyViewingPipelineTest.py => test_LegacyViewingPipeline.py} (99%) rename tests/python/{LogCameraTransformTest.py => test_LogCameraTransform.py} (98%) rename tests/python/{LogTransformTest.py => test_LogTransform.py} (96%) rename tests/python/{LookTest.py => test_Look.py} (99%) rename tests/python/{LookTransformTest.py => test_LookTransform.py} (96%) rename tests/python/{Lut1DTransformTest.py => test_Lut1DTransform.py} (98%) rename tests/python/{Lut3DTransformTest.py => test_Lut3DTransform.py} (98%) rename tests/python/{MatrixTransformTest.py => test_MatrixTransform.py} (98%) rename tests/python/{MixingHelpersTest.py => test_MixingHelpers.py} (99%) rename tests/python/{NamedTransformTest.py => test_NamedTransform.py} (99%) rename tests/python/{OCIOZArchiveTest.py => test_OCIOZArchive.py} (95%) rename tests/python/{OpenColorIOTest.py => test_OpenColorIO.py} (95%) rename tests/python/{ProcessorTest.py => test_Processor.py} (99%) rename tests/python/{RangeTransformTest.py => test_RangeTransform.py} (95%) rename tests/python/{TransformsTest.py => test_Transforms.py} (98%) rename tests/python/{TransformsBaseTest.py => test_TransformsBase.py} (100%) rename tests/python/{ViewTransformTest.py => test_ViewTransform.py} (99%) rename tests/python/{ViewingRulesTest.py => test_ViewingRules.py} (99%) diff --git a/pyproject.toml b/pyproject.toml index 7beeca0879..e4a35e9099 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,10 +32,3 @@ before-build = "share/ci/scripts/macos/install_docs_env.sh" [tool.cibuildwheel.windows] before-build = "bash -c share/ci/scripts/windows/install_docs_env.sh" - -[tool.pytest.ini_options] -python_files = "*Test.py" -python_classes = "Test" -python_functions = "test_*" -addopts = ["--disable-warnings"] -testpaths = ["tests/python"] \ No newline at end of file diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index b177224462..0000000000 --- a/pytest.ini +++ /dev/null @@ -1,10 +0,0 @@ -# TODO: To be removed after python 2 is no longer being used by this project. -# This is a temporary but necessary pytest config file to be replaced by pyproject.toml. - -[pytest] -addopts = --disable-warnings -python_files = *Test.py -python_classes = Test -python_functions = test_* -testpaths = - tests/python \ No newline at end of file diff --git a/tests/python/AllocationTransformTest.py b/tests/python/test_AllocationTransform.py similarity index 97% rename from tests/python/AllocationTransformTest.py rename to tests/python/test_AllocationTransform.py index 5cb954fae3..2fd69d78fa 100644 --- a/tests/python/AllocationTransformTest.py +++ b/tests/python/test_AllocationTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class AllocationTransformTest(unittest.TestCase, TransformsBaseTest): +class TestAllocationTransform(unittest.TestCase, TransformsBaseTest): TEST_ALLOCATION = OCIO.ALLOCATION_LG2 TEST_VARS = [0, 1] TEST_DIRECTION = OCIO.TRANSFORM_DIR_INVERSE diff --git a/tests/python/BakerTest.py b/tests/python/test_Baker.py similarity index 99% rename from tests/python/BakerTest.py rename to tests/python/test_Baker.py index aa48327869..d79e2a5f3d 100644 --- a/tests/python/BakerTest.py +++ b/tests/python/test_Baker.py @@ -6,7 +6,7 @@ import copy, unittest, os, sys import PyOpenColorIO as OCIO -class BakerTest(unittest.TestCase): +class TestBaker(unittest.TestCase): SIMPLE_PROFILE = """ocio_profile_version: 1 diff --git a/tests/python/BuiltinConfigRegistryTest.py b/tests/python/test_BuiltinConfigRegistry.py similarity index 96% rename from tests/python/BuiltinConfigRegistryTest.py rename to tests/python/test_BuiltinConfigRegistry.py index ebb476e478..71d5b6309c 100644 --- a/tests/python/BuiltinConfigRegistryTest.py +++ b/tests/python/test_BuiltinConfigRegistry.py @@ -13,7 +13,7 @@ import PyOpenColorIO as OCIO -class BuiltinConfigRegistryTest(unittest.TestCase): +class TestBuiltinConfigRegistry(unittest.TestCase): # BuiltinRegistry singleton. REGISTRY = None @@ -27,7 +27,7 @@ def test_builtin_config_iterable(self): self.assertIsInstance(name, STRING_TYPES) self.assertIsInstance(self.REGISTRY[name], STRING_TYPES) all_names.append(name) - + # All names were iterated over, and __len__ and list() behave. self.assertEqual(len(all_names), len(self.REGISTRY)) self.assertListEqual(all_names, list(self.REGISTRY)) @@ -38,7 +38,7 @@ def test_builtin_config_iterable(self): # Iterator size is available. self.assertEqual(len(iterator), len(self.REGISTRY)) - + # Iterator supports range-based loop and indexing. values = list(iterator) for i in range(len(iterator)): @@ -83,7 +83,7 @@ def test_get_builtin_configs(self): # Iterator size is available. self.assertEqual(len(iterator), len(self.REGISTRY)) - + # Iterator supports range-based loop and indexing. values = list(iterator) for i in range(len(iterator)): @@ -117,7 +117,7 @@ def test_get_builtin_configs(self): self.assertEqual(values[0][0], "cg-config-v1.0.0_aces-v1.3_ocio-v2.1") # UI name self.assertEqual( - values[0][1], + values[0][1], ("Academy Color Encoding System - CG Config [COLORSPACES v1.0.0] [ACES v1.3] " "[OCIO v2.1]")) # isRecommended @@ -128,20 +128,20 @@ def test_get_builtin_configs(self): self.assertEqual(values[1][0], "studio-config-v1.0.0_aces-v1.3_ocio-v2.1") # UI name self.assertEqual( - values[1][1], + values[1][1], ("Academy Color Encoding System - Studio Config [COLORSPACES v1.0.0] [ACES v1.3] " "[OCIO v2.1]")) # isRecommended self.assertEqual(values[1][2], True) def test_multi_reference(self): - # Registry is a singleton. Make sure multiple Python + # Registry is a singleton. Make sure multiple Python # instances can be held. instances = [] for i in range(10): instances.append(OCIO.BuiltinConfigRegistry()) - # Other instances should still function after deleting one. The + # Other instances should still function after deleting one. The # underlying C++ object is not deleted. instance_0 = instances.pop(0) self.assertEqual(len(instances), 9) @@ -151,7 +151,7 @@ def test_multi_reference(self): with self.assertRaises(NameError): len(instance_0) - # Test underlying C++ reference validity by accessing registry + # Test underlying C++ reference validity by accessing registry # data for each instance. for instance in instances: self.assertGreaterEqual(len(instance), 1) diff --git a/tests/python/BuiltinTransformTest.py b/tests/python/test_BuiltinTransform.py similarity index 89% rename from tests/python/BuiltinTransformTest.py rename to tests/python/test_BuiltinTransform.py index e086ade0e5..58347cf066 100644 --- a/tests/python/BuiltinTransformTest.py +++ b/tests/python/test_BuiltinTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class BuiltinTransformTest(unittest.TestCase, TransformsBaseTest): +class TestBuiltinTransform(unittest.TestCase, TransformsBaseTest): # BuiltinTransformRegistry singleton REGISTRY = None @@ -61,7 +61,7 @@ def test_constructor_keyword(self): self.assertEqual(builtin_tr1.getStyle(), self.EXAMPLE_STYLE) self.assertEqual(builtin_tr1.getDescription(), self.EXAMPLE_DESC) - self.assertEqual(builtin_tr1.getDirection(), + self.assertEqual(builtin_tr1.getDirection(), OCIO.TRANSFORM_DIR_FORWARD) # Keyword args out of order @@ -70,17 +70,17 @@ def test_constructor_keyword(self): self.assertEqual(builtin_tr2.getStyle(), self.EXAMPLE_STYLE) self.assertEqual(builtin_tr2.getDescription(), self.EXAMPLE_DESC) - self.assertEqual(builtin_tr2.getDirection(), + self.assertEqual(builtin_tr2.getDirection(), OCIO.TRANSFORM_DIR_FORWARD) def test_constructor_positional(self): # Positional args - builtin_tr = OCIO.BuiltinTransform(self.EXAMPLE_STYLE, + builtin_tr = OCIO.BuiltinTransform(self.EXAMPLE_STYLE, OCIO.TRANSFORM_DIR_FORWARD) self.assertEqual(builtin_tr.getStyle(), self.EXAMPLE_STYLE) self.assertEqual(builtin_tr.getDescription(), self.EXAMPLE_DESC) - self.assertEqual(builtin_tr.getDirection(), + self.assertEqual(builtin_tr.getDirection(), OCIO.TRANSFORM_DIR_FORWARD) def test_str(self): diff --git a/tests/python/BuiltinTransformRegistryTest.py b/tests/python/test_BuiltinTransformRegistry.py similarity index 96% rename from tests/python/BuiltinTransformRegistryTest.py rename to tests/python/test_BuiltinTransformRegistry.py index fbcd543453..2a44a25e7e 100644 --- a/tests/python/BuiltinTransformRegistryTest.py +++ b/tests/python/test_BuiltinTransformRegistry.py @@ -13,7 +13,7 @@ from UnitTestUtils import STRING_TYPES -class BuiltinTransformRegistryTest(unittest.TestCase): +class TestBuiltinTransformRegistry(unittest.TestCase): # BuiltinTransformRegistry singleton REGISTRY = None @@ -39,7 +39,7 @@ def test_iterable(self): # Iterator size is available self.assertEqual(len(iterator), len(self.REGISTRY)) - + # Iterator supports range-based loop and indexing values = list(iterator) for i in range(len(iterator)): @@ -68,7 +68,7 @@ def test_get_builtins(self): # Iterator size is available self.assertEqual(len(iterator), len(self.REGISTRY)) - + # Iterator supports range-based loop and indexing values = list(iterator) for i in range(len(iterator)): @@ -91,13 +91,13 @@ def test_contains(self): self.assertFalse("invalid" in self.REGISTRY) def test_multi_reference(self): - # Registry is a singleton. Make sure multiple Python + # Registry is a singleton. Make sure multiple Python # instances can be held. instances = [] for i in range(10): instances.append(OCIO.BuiltinTransformRegistry()) - # Other instances should still function after deleting one. The + # Other instances should still function after deleting one. The # underlying C++ object is not deleted. instance_0 = instances.pop(0) self.assertEqual(len(instances), 9) @@ -107,7 +107,7 @@ def test_multi_reference(self): with self.assertRaises(NameError): len(instance_0) - # Test underlying C++ reference validity by accessing registry + # Test underlying C++ reference validity by accessing registry # data for each instance. for instance in instances: self.assertGreaterEqual(len(instance), 1) diff --git a/tests/python/CDLTransformTest.py b/tests/python/test_CDLTransform.py similarity index 96% rename from tests/python/CDLTransformTest.py rename to tests/python/test_CDLTransform.py index 8c03f333e6..7f82209292 100644 --- a/tests/python/CDLTransformTest.py +++ b/tests/python/test_CDLTransform.py @@ -6,10 +6,10 @@ import PyOpenColorIO as OCIO from UnitTestUtils import TEST_DATAFILES_DIR, TEST_NAMES, TEST_DESCS -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class CDLTransformTest(unittest.TestCase, TransformsBaseTest): +class TestCDLTransform(unittest.TestCase, TransformsBaseTest): # Default CDL values on initialization. DEFAULT_CDL_SLOPE = [1.0, 1.0, 1.0] DEFAULT_CDL_OFFSET = [0.0, 0.0, 0.0] diff --git a/tests/python/CPUProcessorTest.py b/tests/python/test_CPUProcessor.py similarity index 81% rename from tests/python/CPUProcessorTest.py rename to tests/python/test_CPUProcessor.py index f33b5448e6..c8f030a885 100644 --- a/tests/python/CPUProcessorTest.py +++ b/tests/python/test_CPUProcessor.py @@ -18,7 +18,7 @@ import PyOpenColorIO as OCIO -class CPUProcessorTest(unittest.TestCase): +class TestCPUProcessor(unittest.TestCase): FLOAT_DELTA = 1e+5 UINT_DELTA = 1 @@ -41,37 +41,37 @@ def setUpClass(cls): # BIT_DEPTH_F16 cls.half_cpu_proc_fwd = cls.proc_fwd.getOptimizedCPUProcessor( - OCIO.BIT_DEPTH_F16, - OCIO.BIT_DEPTH_F16, + OCIO.BIT_DEPTH_F16, + OCIO.BIT_DEPTH_F16, OCIO.OPTIMIZATION_DEFAULT ) cls.half_cpu_proc_inv = cls.proc_inv.getOptimizedCPUProcessor( - OCIO.BIT_DEPTH_F16, - OCIO.BIT_DEPTH_F16, + OCIO.BIT_DEPTH_F16, + OCIO.BIT_DEPTH_F16, OCIO.OPTIMIZATION_DEFAULT ) # BIT_DEPTH_UINT16 cls.uint16_cpu_proc_fwd = cls.proc_fwd.getOptimizedCPUProcessor( - OCIO.BIT_DEPTH_UINT16, - OCIO.BIT_DEPTH_UINT16, + OCIO.BIT_DEPTH_UINT16, + OCIO.BIT_DEPTH_UINT16, OCIO.OPTIMIZATION_DEFAULT ) cls.uint16_cpu_proc_inv = cls.proc_inv.getOptimizedCPUProcessor( - OCIO.BIT_DEPTH_UINT16, - OCIO.BIT_DEPTH_UINT16, + OCIO.BIT_DEPTH_UINT16, + OCIO.BIT_DEPTH_UINT16, OCIO.OPTIMIZATION_DEFAULT ) # BIT_DEPTH_UINT8 cls.uint8_cpu_proc_fwd = cls.proc_fwd.getOptimizedCPUProcessor( - OCIO.BIT_DEPTH_UINT8, - OCIO.BIT_DEPTH_UINT8, + OCIO.BIT_DEPTH_UINT8, + OCIO.BIT_DEPTH_UINT8, OCIO.OPTIMIZATION_DEFAULT ) cls.uint8_cpu_proc_inv = cls.proc_inv.getOptimizedCPUProcessor( - OCIO.BIT_DEPTH_UINT8, - OCIO.BIT_DEPTH_UINT8, + OCIO.BIT_DEPTH_UINT8, + OCIO.BIT_DEPTH_UINT8, OCIO.OPTIMIZATION_DEFAULT ) @@ -83,10 +83,10 @@ def setUpClass(cls): log_range = [float(2**i) for i in range(-15, 15)] cls.float_rgb_list = ( - [-65504.0] + + [-65504.0] + [-x for x in reversed(log_range)] + - [0.0] + - log_range + + [0.0] + + log_range + [65504.0] ) @@ -100,18 +100,18 @@ def setUpClass(cls): # BIT_DEPTH_F32 cls.float_rgb_1d = np.concatenate(( - [-65504.0], - np.flipud(-log_range), - [0.0], - log_range, + [-65504.0], + np.flipud(-log_range), + [0.0], + log_range, [65504.0] )).astype(np.float32) cls.float_rgb_2d = cls.float_rgb_1d.reshape([21, 3]) cls.float_rgb_3d = cls.float_rgb_1d.reshape([7, 3, 3]) cls.float_rgba_1d = np.insert( - cls.float_rgb_1d, - range(3, cls.float_rgb_1d.size+1, 3), + cls.float_rgb_1d, + range(3, cls.float_rgb_1d.size+1, 3), 1.0 ) cls.float_rgba_2d = cls.float_rgba_1d.reshape([21, 4]) @@ -131,16 +131,16 @@ def setUpClass(cls): # BIT_DEPTH_UINT16 cls.uint16_rgb_1d = np.linspace( - 0, 2**16-1, - num=63, + 0, 2**16-1, + num=63, endpoint=True ).astype(np.uint16) cls.uint16_rgb_2d = cls.uint16_rgb_1d.reshape([21, 3]) cls.uint16_rgb_3d = cls.uint16_rgb_1d.reshape([7, 3, 3]) cls.uint16_rgba_1d = np.insert( - cls.uint16_rgb_1d, - range(3, cls.uint16_rgb_1d.size+1, 3), + cls.uint16_rgb_1d, + range(3, cls.uint16_rgb_1d.size+1, 3), cls.uint16_rgb_1d.max() ) cls.uint16_rgba_2d = cls.uint16_rgba_1d.reshape([21, 4]) @@ -148,15 +148,15 @@ def setUpClass(cls): # BIT_DEPTH_UINT8 cls.uint8_rgb_1d = np.linspace( - 0, 2**8-1, - num=63, + 0, 2**8-1, + num=63, endpoint=True).astype(np.uint8) cls.uint8_rgb_2d = cls.uint8_rgb_1d.reshape([21, 3]) cls.uint8_rgb_3d = cls.uint8_rgb_1d.reshape([7, 3, 3]) cls.uint8_rgba_1d = np.insert( - cls.uint8_rgb_1d, - range(3, cls.uint8_rgb_1d.size+1, 3), + cls.uint8_rgb_1d, + range(3, cls.uint8_rgb_1d.size+1, 3), cls.uint8_rgb_1d.max() ) cls.uint8_rgba_2d = cls.uint8_rgba_1d.reshape([21, 4]) @@ -227,41 +227,41 @@ def test_cache_id(self): def test_bit_depth(self): # BIT_DEPTH_F32 self.assertEqual( - self.default_cpu_proc_fwd.getInputBitDepth(), + self.default_cpu_proc_fwd.getInputBitDepth(), OCIO.BIT_DEPTH_F32 ) self.assertEqual( - self.default_cpu_proc_fwd.getOutputBitDepth(), + self.default_cpu_proc_fwd.getOutputBitDepth(), OCIO.BIT_DEPTH_F32 ) # BIT_DEPTH_F16 self.assertEqual( - self.half_cpu_proc_fwd.getInputBitDepth(), + self.half_cpu_proc_fwd.getInputBitDepth(), OCIO.BIT_DEPTH_F16 ) self.assertEqual( - self.half_cpu_proc_fwd.getOutputBitDepth(), + self.half_cpu_proc_fwd.getOutputBitDepth(), OCIO.BIT_DEPTH_F16 ) # BIT_DEPTH_UINT16 self.assertEqual( - self.uint16_cpu_proc_fwd.getInputBitDepth(), + self.uint16_cpu_proc_fwd.getInputBitDepth(), OCIO.BIT_DEPTH_UINT16 ) self.assertEqual( - self.uint16_cpu_proc_fwd.getOutputBitDepth(), + self.uint16_cpu_proc_fwd.getOutputBitDepth(), OCIO.BIT_DEPTH_UINT16 ) # BIT_DEPTH_UINT8 self.assertEqual( - self.uint8_cpu_proc_fwd.getInputBitDepth(), + self.uint8_cpu_proc_fwd.getInputBitDepth(), OCIO.BIT_DEPTH_UINT8 ) self.assertEqual( - self.uint8_cpu_proc_fwd.getOutputBitDepth(), + self.uint8_cpu_proc_fwd.getOutputBitDepth(), OCIO.BIT_DEPTH_UINT8 ) @@ -303,7 +303,7 @@ def test_apply(self): for i in range(arr.size): self.assertAlmostEqual( - arr.flat[i], + arr.flat[i], self.float_rgb_3d.flat[i] * 0.5, delta=self.FLOAT_DELTA ) @@ -313,7 +313,7 @@ def test_apply(self): for i in range(arr.size): self.assertAlmostEqual( - arr.flat[i], + arr.flat[i], self.float_rgb_3d.flat[i], delta=self.FLOAT_DELTA ) @@ -356,7 +356,7 @@ def test_apply_src_dst(self): delta=self.FLOAT_DELTA ) self.assertAlmostEqual( - dst_arr2.flat[i], + dst_arr2.flat[i], self.float_rgb_3d.flat[i], delta=self.FLOAT_DELTA ) @@ -367,7 +367,7 @@ def test_apply_rgb_list(self): for i in range(len(fwd_result)): self.assertAlmostEqual( - fwd_result[i], + fwd_result[i], self.float_rgb_list[i] * 0.5, delta=self.FLOAT_DELTA ) @@ -377,7 +377,7 @@ def test_apply_rgb_list(self): for i in range(len(fwd_result)): self.assertAlmostEqual( - inv_result[i], + inv_result[i], self.float_rgb_list[i], delta=self.FLOAT_DELTA ) @@ -389,63 +389,63 @@ def test_apply_rgb_buffer(self): for arr, cpu_proc_fwd, cpu_proc_inv in [ ( - self.float_rgb_1d, - self.default_cpu_proc_fwd, + self.float_rgb_1d, + self.default_cpu_proc_fwd, self.default_cpu_proc_inv ), ( - self.float_rgb_2d, - self.default_cpu_proc_fwd, + self.float_rgb_2d, + self.default_cpu_proc_fwd, self.default_cpu_proc_inv ), ( - self.float_rgb_3d, - self.default_cpu_proc_fwd, + self.float_rgb_3d, + self.default_cpu_proc_fwd, self.default_cpu_proc_inv ), ( - self.half_rgb_1d, - self.half_cpu_proc_fwd, + self.half_rgb_1d, + self.half_cpu_proc_fwd, self.half_cpu_proc_inv ), ( - self.half_rgb_2d, - self.half_cpu_proc_fwd, + self.half_rgb_2d, + self.half_cpu_proc_fwd, self.half_cpu_proc_inv ), ( - self.half_rgb_3d, - self.half_cpu_proc_fwd, + self.half_rgb_3d, + self.half_cpu_proc_fwd, self.half_cpu_proc_inv ), ( - self.uint16_rgb_1d, - self.uint16_cpu_proc_fwd, + self.uint16_rgb_1d, + self.uint16_cpu_proc_fwd, self.uint16_cpu_proc_inv ), ( - self.uint16_rgb_2d, - self.uint16_cpu_proc_fwd, + self.uint16_rgb_2d, + self.uint16_cpu_proc_fwd, self.uint16_cpu_proc_inv ), ( - self.uint16_rgb_3d, - self.uint16_cpu_proc_fwd, + self.uint16_rgb_3d, + self.uint16_cpu_proc_fwd, self.uint16_cpu_proc_inv ), ( - self.uint8_rgb_1d, - self.uint8_cpu_proc_fwd, + self.uint8_rgb_1d, + self.uint8_cpu_proc_fwd, self.uint8_cpu_proc_inv ), ( - self.uint8_rgb_2d, - self.uint8_cpu_proc_fwd, + self.uint8_rgb_2d, + self.uint8_cpu_proc_fwd, self.uint8_cpu_proc_inv ), ( - self.uint8_rgb_3d, - self.uint8_cpu_proc_fwd, + self.uint8_rgb_3d, + self.uint8_cpu_proc_fwd, self.uint8_cpu_proc_inv ), ]: @@ -458,13 +458,13 @@ def test_apply_rgb_buffer(self): for i in range(arr_copy.size): if arr.dtype in (np.float32, np.float16): self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i] * 0.5, delta=self.FLOAT_DELTA ) else: self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i] // 2, delta=self.UINT_DELTA ) @@ -475,13 +475,13 @@ def test_apply_rgb_buffer(self): for i in range(arr_copy.size): if arr.dtype in (np.float32, np.float16): self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i], delta=self.FLOAT_DELTA ) else: self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i], delta=self.UINT_DELTA ) @@ -496,7 +496,7 @@ def test_apply_rgba_list(self): self.assertEqual(fwd_result[i], self.float_rgba_list[i]) else: self.assertAlmostEqual( - fwd_result[i], + fwd_result[i], self.float_rgba_list[i] * 0.5, delta=self.FLOAT_DELTA ) @@ -510,7 +510,7 @@ def test_apply_rgba_list(self): self.assertEqual(fwd_result[i], self.float_rgba_list[i]) else: self.assertAlmostEqual( - inv_result[i], + inv_result[i], self.float_rgba_list[i], delta=self.FLOAT_DELTA ) @@ -522,63 +522,63 @@ def test_apply_rgba_buffer(self): for arr, cpu_proc_fwd, cpu_proc_inv in [ ( - self.float_rgba_1d, - self.default_cpu_proc_fwd, + self.float_rgba_1d, + self.default_cpu_proc_fwd, self.default_cpu_proc_inv ), ( - self.float_rgba_2d, - self.default_cpu_proc_fwd, + self.float_rgba_2d, + self.default_cpu_proc_fwd, self.default_cpu_proc_inv ), ( - self.float_rgba_3d, - self.default_cpu_proc_fwd, + self.float_rgba_3d, + self.default_cpu_proc_fwd, self.default_cpu_proc_inv ), ( - self.half_rgba_1d, - self.half_cpu_proc_fwd, + self.half_rgba_1d, + self.half_cpu_proc_fwd, self.half_cpu_proc_inv ), ( - self.half_rgba_2d, - self.half_cpu_proc_fwd, + self.half_rgba_2d, + self.half_cpu_proc_fwd, self.half_cpu_proc_inv ), ( - self.half_rgba_3d, - self.half_cpu_proc_fwd, + self.half_rgba_3d, + self.half_cpu_proc_fwd, self.half_cpu_proc_inv ), ( - self.uint16_rgba_1d, - self.uint16_cpu_proc_fwd, + self.uint16_rgba_1d, + self.uint16_cpu_proc_fwd, self.uint16_cpu_proc_inv ), ( - self.uint16_rgba_2d, - self.uint16_cpu_proc_fwd, + self.uint16_rgba_2d, + self.uint16_cpu_proc_fwd, self.uint16_cpu_proc_inv ), ( - self.uint16_rgba_3d, - self.uint16_cpu_proc_fwd, + self.uint16_rgba_3d, + self.uint16_cpu_proc_fwd, self.uint16_cpu_proc_inv ), ( - self.uint8_rgba_1d, - self.uint8_cpu_proc_fwd, + self.uint8_rgba_1d, + self.uint8_cpu_proc_fwd, self.uint8_cpu_proc_inv ), ( - self.uint8_rgba_2d, - self.uint8_cpu_proc_fwd, + self.uint8_rgba_2d, + self.uint8_cpu_proc_fwd, self.uint8_cpu_proc_inv ), ( - self.uint8_rgba_3d, - self.uint8_cpu_proc_fwd, + self.uint8_rgba_3d, + self.uint8_cpu_proc_fwd, self.uint8_cpu_proc_inv ), ]: @@ -594,13 +594,13 @@ def test_apply_rgba_buffer(self): self.assertEqual(arr_copy.flat[i], arr.flat[i]) elif arr.dtype in (np.float32, np.float16): self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i] * 0.5, delta=self.FLOAT_DELTA ) else: self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i] // 2, delta=self.UINT_DELTA ) @@ -614,13 +614,13 @@ def test_apply_rgba_buffer(self): self.assertEqual(arr_copy.flat[i], arr.flat[i]) elif arr.dtype in (np.float32, np.float16): self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i], delta=self.FLOAT_DELTA ) else: self.assertAlmostEqual( - arr_copy.flat[i], + arr_copy.flat[i], arr.flat[i], delta=self.UINT_DELTA ) diff --git a/tests/python/ColorSpaceTest.py b/tests/python/test_ColorSpace.py similarity index 99% rename from tests/python/ColorSpaceTest.py rename to tests/python/test_ColorSpace.py index 6567fc77ea..6df46f854f 100644 --- a/tests/python/ColorSpaceTest.py +++ b/tests/python/test_ColorSpace.py @@ -10,7 +10,7 @@ from UnitTestUtils import SIMPLE_CONFIG, TEST_NAMES, TEST_DESCS, TEST_CATEGORIES -class ColorSpaceTest(unittest.TestCase): +class TestColorSpace(unittest.TestCase): def setUp(self): self.colorspace = OCIO.ColorSpace() diff --git a/tests/python/ColorSpaceHelpersTest.py b/tests/python/test_ColorSpaceHelpers.py similarity index 99% rename from tests/python/ColorSpaceHelpersTest.py rename to tests/python/test_ColorSpaceHelpers.py index 131a784214..e582405082 100644 --- a/tests/python/ColorSpaceHelpersTest.py +++ b/tests/python/test_ColorSpaceHelpers.py @@ -9,7 +9,7 @@ from UnitTestUtils import SAMPLE_CONFIG -class ColorSpaceHelpersTest(unittest.TestCase): +class TestColorSpaceHelpers(unittest.TestCase): def setUp(self): self.cfg = OCIO.Config().CreateFromStream(SAMPLE_CONFIG) @@ -86,7 +86,7 @@ def test_menu_creation_colorspaces(self): params = OCIO.ColorSpaceMenuParameters(config = self.cfg) menu = OCIO.ColorSpaceMenuHelper(params) - + # [raw, lin_1, lin_2, log_1, in_1, in_2, in_3, view_1, view_2, view_3, lut_input_1, lut_input_2, lut_input_3, # display_lin_1, display_lin_2, display_log_1] self.assertEqual(menu.getNumColorSpaces(), 16) diff --git a/tests/python/ColorSpaceTransformTest.py b/tests/python/test_ColorSpaceTransform.py similarity index 96% rename from tests/python/ColorSpaceTransformTest.py rename to tests/python/test_ColorSpaceTransform.py index 334acfeef2..e8887db8b5 100644 --- a/tests/python/ColorSpaceTransformTest.py +++ b/tests/python/test_ColorSpaceTransform.py @@ -5,10 +5,10 @@ import PyOpenColorIO as OCIO from UnitTestUtils import TEST_NAMES -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class ColorSpaceTransformTest(unittest.TestCase, TransformsBaseTest): +class TestColorSpaceTransform(unittest.TestCase, TransformsBaseTest): TEST_DIRECTION = OCIO.TRANSFORM_DIR_FORWARD TEST_SRC = 'foo' TEST_DST = 'bar' diff --git a/tests/python/ConfigTest.py b/tests/python/test_Config.py similarity index 99% rename from tests/python/ConfigTest.py rename to tests/python/test_Config.py index 1ea0e2d928..068d7f1130 100644 --- a/tests/python/ConfigTest.py +++ b/tests/python/test_Config.py @@ -245,7 +245,7 @@ # del _cfg -class ConfigTest(unittest.TestCase): +class TestConfig(unittest.TestCase): def test_copy(self): """ @@ -961,7 +961,7 @@ def test_create_builtin_config(self): # ******************************** # Testing default config. # ******************************** - + # Testing CreateFromEnv with the default config using URI Syntax. try: OCIO.SetEnvVariable('OCIO', 'ocio://default') @@ -987,27 +987,27 @@ def test_create_builtin_config(self): OCIO.Config.CreateFromBuiltinConfig("I-do-not-exist") self.assertEqual( - str(cm.exception), + str(cm.exception), "Could not find 'I-do-not-exist' in the built-in configurations." ) - + # Testing CreateFromFile with an unknown built-in config name using URI syntax. with self.assertRaises(OCIO.Exception) as cm: OCIO.Config.CreateFromFile("ocio://I-do-not-exist") self.assertEqual( - str(cm.exception), + str(cm.exception), "Could not find 'I-do-not-exist' in the built-in configurations." ) # Testing CreateFromEnv with an unknown built-in config. try: OCIO.SetEnvVariable('OCIO', 'ocio://thedefault') - with self.assertRaises(OCIO.Exception) as cm: + with self.assertRaises(OCIO.Exception) as cm: OCIO.Config.CreateFromEnv() self.assertEqual( - str(cm.exception), + str(cm.exception), "Could not find 'thedefault' in the built-in configurations." ) finally: @@ -1022,7 +1022,7 @@ def test_create_from_archive(self): ) config = OCIO.Config.CreateFromFile(ocioz_file) config.validate() - + # Simple check on the number of color spaces in the test config. self.assertEqual(len(config.getColorSpaceNames()), 13) @@ -1038,7 +1038,7 @@ def test_create_from_archive(self): ) config = OCIO.Config.CreateFromFile(ocioz_file) config.validate() - + # Simple check on the number of color spaces in the test config. self.assertEqual(len(config.getColorSpaceNames()), 13) @@ -1080,7 +1080,7 @@ def test_create_from_archive(self): config.getProcessor("plain_lut1_cs", "shot1_lut1_cs") def test_create_from_config_io_proxy(self): - + # Simulate that the config and LUT are in memory by initializing three variables # simple_config is the config @@ -1170,7 +1170,7 @@ def lutExists(filepath): # Check if the file exists. if lutExists(filepath): - # This is a bad hash, but using the filename as hash for simplicity and + # This is a bad hash, but using the filename as hash for simplicity and # demonstration purpose. hash = filepath return hash @@ -1186,7 +1186,7 @@ def lutExists(filepath): processor = config.getProcessor("c1", "c2") processor.getDefaultCPUProcessor() -class ConfigVirtualWithActiveDisplayTest(unittest.TestCase): +class TestConfigVirtualWithActiveDisplay(unittest.TestCase): def setUp(self): self.cfg_active_display = OCIO.Config.CreateFromStream( SIMPLE_CONFIG_VIRTUAL_DISPLAY_ACTIVE_DISPLAY) @@ -1207,7 +1207,7 @@ def test_virtual_display_with_active_displays(self): self.assertEqual(len(views), 1) -class ConfigVirtualDisplayTest(unittest.TestCase): +class TestConfigVirtualDisplay(unittest.TestCase): def setUp(self): self.cfg = OCIO.Config.CreateFromStream(SIMPLE_CONFIG_VIRTUAL_DISPLAY) diff --git a/tests/python/ConstantsTest.py b/tests/python/test_Constants.py similarity index 98% rename from tests/python/ConstantsTest.py rename to tests/python/test_Constants.py index 852d6a9072..f67152c938 100644 --- a/tests/python/ConstantsTest.py +++ b/tests/python/test_Constants.py @@ -4,7 +4,7 @@ import unittest, os, sys import PyOpenColorIO as OCIO -class ConstantsTest(unittest.TestCase): +class TestConstants(unittest.TestCase): def test_string_constants(self): """ diff --git a/tests/python/ContextTest.py b/tests/python/test_Context.py similarity index 98% rename from tests/python/ContextTest.py rename to tests/python/test_Context.py index 5cfc847fd8..30c0231b99 100644 --- a/tests/python/ContextTest.py +++ b/tests/python/test_Context.py @@ -4,7 +4,7 @@ import copy, unittest, os, sys import PyOpenColorIO as OCIO -class ContextTest(unittest.TestCase): +class TestContext(unittest.TestCase): def test_copy(self): """ diff --git a/tests/python/DisplayViewHelpersTest.py b/tests/python/test_DisplayViewHelpers.py similarity index 99% rename from tests/python/DisplayViewHelpersTest.py rename to tests/python/test_DisplayViewHelpers.py index e57d7e8f17..04aac946d3 100644 --- a/tests/python/DisplayViewHelpersTest.py +++ b/tests/python/test_DisplayViewHelpers.py @@ -9,7 +9,7 @@ from UnitTestUtils import SAMPLE_CONFIG, TEST_DATAFILES_DIR -class DisplayViewHelpersTest(unittest.TestCase): +class TestDisplayViewHelpers(unittest.TestCase): def setUp(self): self.cfg = OCIO.Config().CreateFromStream(SAMPLE_CONFIG) diff --git a/tests/python/DisplayViewTransformTest.py b/tests/python/test_DisplayViewTransform.py similarity index 98% rename from tests/python/DisplayViewTransformTest.py rename to tests/python/test_DisplayViewTransform.py index eff94ae0ae..cd56843cf7 100644 --- a/tests/python/DisplayViewTransformTest.py +++ b/tests/python/test_DisplayViewTransform.py @@ -5,10 +5,10 @@ import PyOpenColorIO as OCIO from UnitTestUtils import TEST_DATAFILES_DIR, TEST_NAMES, TEST_DESCS -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class DisplayViewTransformTest(unittest.TestCase, TransformsBaseTest): +class TestDisplayViewTransform(unittest.TestCase, TransformsBaseTest): TEST_SRC = ['abc', 'raw', '$test'] TEST_DISPLAY = ['display1', 'display2'] diff --git a/tests/python/ExponentTransformTest.py b/tests/python/test_ExponentTransform.py similarity index 97% rename from tests/python/ExponentTransformTest.py rename to tests/python/test_ExponentTransform.py index 9ae4365768..3478d473d4 100644 --- a/tests/python/ExponentTransformTest.py +++ b/tests/python/test_ExponentTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class ExponentTransformTest(unittest.TestCase, TransformsBaseTest): +class TestExponentTransform(unittest.TestCase, TransformsBaseTest): TEST_ID = 'sample exponent' TEST_VALUES = [1, 2, 3, 4] TEST_NEGATIVE_STYLE = OCIO.NEGATIVE_MIRROR diff --git a/tests/python/ExponentWithLinearTransformTest.py b/tests/python/test_ExponentWithLinearTransform.py similarity index 98% rename from tests/python/ExponentWithLinearTransformTest.py rename to tests/python/test_ExponentWithLinearTransform.py index d8b55929d5..ff8769da60 100644 --- a/tests/python/ExponentWithLinearTransformTest.py +++ b/tests/python/test_ExponentWithLinearTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class ExponentWithLinearTransformTest(unittest.TestCase, TransformsBaseTest): +class TestExponentWithLinearTransform(unittest.TestCase, TransformsBaseTest): TEST_ID = 'sample exponent linear' TEST_GAMMA = [1, 2, 3, 4] TEST_OFFSET = [0.1, 0.2, 0.3, 0.4] diff --git a/tests/python/ExposureContrastTransformTest.py b/tests/python/test_ExposureContrastTransform.py similarity index 98% rename from tests/python/ExposureContrastTransformTest.py rename to tests/python/test_ExposureContrastTransform.py index 8d28aaac3c..6dba5650f6 100644 --- a/tests/python/ExposureContrastTransformTest.py +++ b/tests/python/test_ExposureContrastTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class ExposureContrastTransformTest(unittest.TestCase, TransformsBaseTest): +class TestExposureContrastTransform(unittest.TestCase, TransformsBaseTest): TEST_ID = 'sample exponent linear' TEST_NAME = 'name' TEST_VALUES = [0.1, 2, -0.5, 10] diff --git a/tests/python/FileRulesTest.py b/tests/python/test_FileRules.py similarity index 99% rename from tests/python/FileRulesTest.py rename to tests/python/test_FileRules.py index 4dc6b9c50c..793ca9b2cf 100644 --- a/tests/python/FileRulesTest.py +++ b/tests/python/test_FileRules.py @@ -4,7 +4,7 @@ import copy, unittest, os, sys import PyOpenColorIO as OCIO -class FileRulesTest(unittest.TestCase): +class TestFileRules(unittest.TestCase): def test_copy(self): """ diff --git a/tests/python/FileTransformTest.py b/tests/python/test_FileTransform.py similarity index 98% rename from tests/python/FileTransformTest.py rename to tests/python/test_FileTransform.py index 84ac59ca42..2cde754b72 100644 --- a/tests/python/FileTransformTest.py +++ b/tests/python/test_FileTransform.py @@ -6,10 +6,10 @@ import PyOpenColorIO as OCIO from UnitTestUtils import TEST_DATAFILES_DIR, TEST_NAMES -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class FileTransformTest(unittest.TestCase, TransformsBaseTest): +class TestFileTransform(unittest.TestCase, TransformsBaseTest): TEST_DIRECTION = OCIO.TRANSFORM_DIR_FORWARD TEST_INTERPOLATION = OCIO.Interpolation.INTERP_LINEAR TEST_ID = 'sample file' diff --git a/tests/python/FixedFunctionTransformTest.py b/tests/python/test_FixedFunctionTransform.py similarity index 98% rename from tests/python/FixedFunctionTransformTest.py rename to tests/python/test_FixedFunctionTransform.py index ce4868ae78..5d2e297ac5 100644 --- a/tests/python/FixedFunctionTransformTest.py +++ b/tests/python/test_FixedFunctionTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class FixedFunctionTransformTest(unittest.TestCase, TransformsBaseTest): +class TestFixedFunctionTransform(unittest.TestCase, TransformsBaseTest): TEST_STYLE = OCIO.FIXED_FUNCTION_ACES_GLOW_03 TEST_PARAMS = [0, 1, 2] TEST_DIRECTION = OCIO.TRANSFORM_DIR_INVERSE diff --git a/tests/python/FormatMetadataTest.py b/tests/python/test_FormatMetadata.py similarity index 99% rename from tests/python/FormatMetadataTest.py rename to tests/python/test_FormatMetadata.py index 34bd5412e3..a1841d68a2 100644 --- a/tests/python/FormatMetadataTest.py +++ b/tests/python/test_FormatMetadata.py @@ -7,7 +7,7 @@ import PyOpenColorIO as OCIO -class FormatMetadataTest(unittest.TestCase): +class TestFormatMetadata(unittest.TestCase): def test_default(self): """ diff --git a/tests/python/GpuShaderDescTest.py b/tests/python/test_GpuShaderDesc.py similarity index 96% rename from tests/python/GpuShaderDescTest.py rename to tests/python/test_GpuShaderDesc.py index e70e35def6..77fbeeafa0 100644 --- a/tests/python/GpuShaderDescTest.py +++ b/tests/python/test_GpuShaderDesc.py @@ -20,7 +20,7 @@ from UnitTestUtils import STRING_TYPES -class GpuShaderDescTest(unittest.TestCase): +class TestGpuShaderDesc(unittest.TestCase): def test_shader_creator_interface(self): desc = OCIO.GpuShaderDesc.CreateShaderDesc() @@ -35,7 +35,7 @@ def test_shader_creator_interface(self): def test_uniform(self): # Test dynamic exposure and gamma config = OCIO.Config() - tr = OCIO.ExposureContrastTransform(dynamicExposure=True, + tr = OCIO.ExposureContrastTransform(dynamicExposure=True, dynamicGamma=True) proc = config.getProcessor(tr) desc = OCIO.GpuShaderDesc.CreateShaderDesc() @@ -93,8 +93,8 @@ def test_vector_uniform(self): self.assertTrue(isinstance(vector_int, np.ndarray)) self.assertEqual(vector_int.dtype, np.intc) self.assertTrue(np.array_equal( - vector_int, - np.array([0, 2, 2, 2, 4, 2, 6, 2], + vector_int, + np.array([0, 2, 2, 2, 4, 2, 6, 2], dtype=np.intc)) ) @@ -104,8 +104,8 @@ def test_vector_uniform(self): self.assertTrue(isinstance(vector_float, np.ndarray)) self.assertEqual(vector_float.dtype, np.float32) self.assertTrue(np.array_equal( - vector_float, - np.array([1.0, 3.0, 1.0, 3.0, 1.0, 3.0, 1.0, 3.0], + vector_float, + np.array([1.0, 3.0, 1.0, 3.0, 1.0, 3.0, 1.0, 3.0], dtype=np.float32)) ) @@ -119,8 +119,8 @@ def test_vector_uniform(self): ) self.assertTrue(np.array_equal( - uniforms[1][1].getVectorFloat(), - np.array([5.0, 7.0, 5.0, 7.0, 5.0, 7.0, 5.0, 7.0], + uniforms[1][1].getVectorFloat(), + np.array([5.0, 7.0, 5.0, 7.0, 5.0, 7.0, 5.0, 7.0], dtype=np.float32)) ) diff --git a/tests/python/GradingDataTest.py b/tests/python/test_GradingData.py similarity index 99% rename from tests/python/GradingDataTest.py rename to tests/python/test_GradingData.py index 7c376425c6..763c7abba4 100644 --- a/tests/python/GradingDataTest.py +++ b/tests/python/test_GradingData.py @@ -8,7 +8,7 @@ import PyOpenColorIO as OCIO from UnitTestUtils import assertEqualRGBM, assertEqualPrimary, assertEqualRGBMSW, assertEqualTone, assertEqualBSpline, assertEqualRGBCurve -class GradingDataTest(unittest.TestCase): +class TestGradingData(unittest.TestCase): def test_rgbm(self): """ @@ -62,7 +62,7 @@ def test_rgbm(self): with self.assertRaises(TypeError): OCIO.GradingRGBM(0, 0) - + # Constructor with named parameters. rgbm3 = OCIO.GradingRGBM(blue=1, green=2, master=3, red=4) self.assertEqual(4, rgbm3.red) @@ -221,7 +221,7 @@ def test_rgbcurve(self): rgbVideo = OCIO.GradingRGBCurve(OCIO.GRADING_LOG) assertEqualRGBCurve(self, rgbLog, rgbVideo) - + def test_rgbmsw(self): """ Test the GradingRGBMSW struct. diff --git a/tests/python/GradingPrimaryTransformTest.py b/tests/python/test_GradingPrimaryTransform.py similarity index 99% rename from tests/python/GradingPrimaryTransformTest.py rename to tests/python/test_GradingPrimaryTransform.py index 074e750987..7a48c048e8 100644 --- a/tests/python/GradingPrimaryTransformTest.py +++ b/tests/python/test_GradingPrimaryTransform.py @@ -8,7 +8,7 @@ import PyOpenColorIO as OCIO from UnitTestUtils import assertEqualPrimary -class GradingPrimaryTransformTest(unittest.TestCase): +class TestGradingPrimaryTransform(unittest.TestCase): valsDefault = OCIO.GradingPrimary(OCIO.GRADING_LIN) valsDefaultLog = OCIO.GradingPrimary(OCIO.GRADING_LOG) diff --git a/tests/python/GradingRGBCurveTransformTest.py b/tests/python/test_GradingRGBCurveTransform.py similarity index 97% rename from tests/python/GradingRGBCurveTransformTest.py rename to tests/python/test_GradingRGBCurveTransform.py index 6b64744012..efb228154e 100644 --- a/tests/python/GradingRGBCurveTransformTest.py +++ b/tests/python/test_GradingRGBCurveTransform.py @@ -8,7 +8,7 @@ import PyOpenColorIO as OCIO from UnitTestUtils import assertEqualRGBCurve -class GradingRGBCurveTransformTest(unittest.TestCase): +class TestGradingRGBCurveTransform(unittest.TestCase): valDefaultLin = OCIO.GradingRGBCurve(OCIO.GRADING_LIN) valDefaultLog = OCIO.GradingRGBCurve(OCIO.GRADING_LOG) @@ -93,7 +93,7 @@ def test_validation(self): # 3rd control point x is lower than 2nd control point x. vals = OCIO.GradingRGBCurve(OCIO.GRADING_LOG) vals.red = OCIO.GradingBSplineCurve([0, 0, 0.5, 0.2, 0.2, 0.5, 1, 1]) - + with self.assertRaises(OCIO.Exception): gct.setValue(vals); @@ -154,8 +154,8 @@ def test_apply_with_slopes(self): self.assertEqual(gct.slopesAreDefault(OCIO.RGB_MASTER), True) slopes = [ 0., 0.55982688, 1.77532247, 1.55, 0.8787017, 0.18374463, 0. ] - for i in range(0, len(slopes)): - gct.setSlope( OCIO.RGB_MASTER, i, slopes[i] ) + for i, slope in enumerate(slopes): + gct.setSlope(OCIO.RGB_MASTER, i, slope) gct.validate() self.assertAlmostEqual(1.55, gct.getSlope(OCIO.RGB_MASTER, 3), delta=1e-5) diff --git a/tests/python/GradingToneTransformTest.py b/tests/python/test_GradingToneTransform.py similarity index 99% rename from tests/python/GradingToneTransformTest.py rename to tests/python/test_GradingToneTransform.py index 180e0d28f6..67c30d8791 100644 --- a/tests/python/GradingToneTransformTest.py +++ b/tests/python/test_GradingToneTransform.py @@ -8,7 +8,7 @@ import PyOpenColorIO as OCIO from UnitTestUtils import assertEqualTone -class GradingToneTransformTest(unittest.TestCase): +class TestGradingToneTransform(unittest.TestCase): valsDefaultLog = OCIO.GradingTone(OCIO.GRADING_LOG) valsDefaultLin = OCIO.GradingTone(OCIO.GRADING_LIN) diff --git a/tests/python/GroupTransformTest.py b/tests/python/test_GroupTransform.py similarity index 98% rename from tests/python/GroupTransformTest.py rename to tests/python/test_GroupTransform.py index 0b4e47da68..f560970056 100644 --- a/tests/python/GroupTransformTest.py +++ b/tests/python/test_GroupTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class GroupTransformTest(unittest.TestCase, TransformsBaseTest): +class TestGroupTransform(unittest.TestCase, TransformsBaseTest): TEST_DIRECTION = OCIO.TRANSFORM_DIR_INVERSE def setUp(self): diff --git a/tests/python/LegacyViewingPipelineTest.py b/tests/python/test_LegacyViewingPipeline.py similarity index 99% rename from tests/python/LegacyViewingPipelineTest.py rename to tests/python/test_LegacyViewingPipeline.py index 8b4e3ea5e3..fc99c9fc32 100644 --- a/tests/python/LegacyViewingPipelineTest.py +++ b/tests/python/test_LegacyViewingPipeline.py @@ -9,7 +9,7 @@ from UnitTestUtils import SAMPLE_CONFIG -class LegacyViewingPipelineTest(unittest.TestCase): +class TestLegacyViewingPipeline(unittest.TestCase): def test_looks_override(self): """ diff --git a/tests/python/LogCameraTransformTest.py b/tests/python/test_LogCameraTransform.py similarity index 98% rename from tests/python/LogCameraTransformTest.py rename to tests/python/test_LogCameraTransform.py index 5ef890d06e..5f68419f58 100644 --- a/tests/python/LogCameraTransformTest.py +++ b/tests/python/test_LogCameraTransform.py @@ -7,7 +7,7 @@ import PyOpenColorIO as OCIO -class LogCameraTransformTest(unittest.TestCase): +class TestLogCameraTransform(unittest.TestCase): LIN_SB = [0.1, 0.2, 0.3] @@ -334,7 +334,7 @@ def test_validate(self): lct = OCIO.LogCameraTransform(self.LIN_SB) lct.validate() - # Components of logSideSlope can't be 0. + # Components of logSideSlope can't be 0. lct.setLogSideSlopeValue([0, 0, 0]) with self.assertRaises(OCIO.Exception): lct.validate() @@ -350,7 +350,7 @@ def test_validate(self): lct.setLogSideSlopeValue([0.1, 0.1, 0.1]) - # Components of linSideSlope can't be 0. + # Components of linSideSlope can't be 0. lct.setLinSideSlopeValue([0, 0, 0]) with self.assertRaises(OCIO.Exception): lct.validate() @@ -377,4 +377,3 @@ def test_validate(self): lct.setBase(invalid) with self.assertRaises(OCIO.Exception): lct.validate() - diff --git a/tests/python/LogTransformTest.py b/tests/python/test_LogTransform.py similarity index 96% rename from tests/python/LogTransformTest.py rename to tests/python/test_LogTransform.py index ed521a68c0..e52433ed19 100644 --- a/tests/python/LogTransformTest.py +++ b/tests/python/test_LogTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class LogTransformTest(unittest.TestCase, TransformsBaseTest): +class TestLogTransform(unittest.TestCase, TransformsBaseTest): TEST_ID = 'sample log' TEST_NAME = 'name of log' TEST_BASE = 10 diff --git a/tests/python/LookTest.py b/tests/python/test_Look.py similarity index 99% rename from tests/python/LookTest.py rename to tests/python/test_Look.py index 16f6e32488..c9be9e10fe 100644 --- a/tests/python/LookTest.py +++ b/tests/python/test_Look.py @@ -10,7 +10,7 @@ from UnitTestUtils import TEST_NAMES, TEST_DESCS -class LookTest(unittest.TestCase): +class TestLook(unittest.TestCase): TEST_PROCESS_SPACES = ['raw', 'lnh', 'vd8', 'a.b.c.', '1-2-3-'] TEST_EXP_VALUES = [0.1, 0.2, 0.3, 0.4] diff --git a/tests/python/LookTransformTest.py b/tests/python/test_LookTransform.py similarity index 96% rename from tests/python/LookTransformTest.py rename to tests/python/test_LookTransform.py index 9a9d436663..627e6cc35b 100644 --- a/tests/python/LookTransformTest.py +++ b/tests/python/test_LookTransform.py @@ -4,10 +4,10 @@ import unittest import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class LookTransformTest(unittest.TestCase, TransformsBaseTest): +class TestLookTransform(unittest.TestCase, TransformsBaseTest): def setUp(self): self.tr = OCIO.LookTransform('src', 'dst') diff --git a/tests/python/Lut1DTransformTest.py b/tests/python/test_Lut1DTransform.py similarity index 98% rename from tests/python/Lut1DTransformTest.py rename to tests/python/test_Lut1DTransform.py index 60f926c324..14995f7563 100644 --- a/tests/python/Lut1DTransformTest.py +++ b/tests/python/test_Lut1DTransform.py @@ -16,10 +16,10 @@ np = None import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class Lut1DTransformTest(unittest.TestCase, TransformsBaseTest): +class TestLut1DTransform(unittest.TestCase, TransformsBaseTest): def setUp(self): self.tr = OCIO.Lut1DTransform() diff --git a/tests/python/Lut3DTransformTest.py b/tests/python/test_Lut3DTransform.py similarity index 98% rename from tests/python/Lut3DTransformTest.py rename to tests/python/test_Lut3DTransform.py index 249ea6fcca..af68695464 100644 --- a/tests/python/Lut3DTransformTest.py +++ b/tests/python/test_Lut3DTransform.py @@ -16,10 +16,10 @@ np = None import PyOpenColorIO as OCIO -from TransformsBaseTest import TransformsBaseTest +from test_TransformsBase import TransformsBaseTest -class Lut3DTransformTest(unittest.TestCase, TransformsBaseTest): +class TestLut3DTransform(unittest.TestCase, TransformsBaseTest): def setUp(self): self.tr = OCIO.Lut3DTransform() diff --git a/tests/python/MatrixTransformTest.py b/tests/python/test_MatrixTransform.py similarity index 98% rename from tests/python/MatrixTransformTest.py rename to tests/python/test_MatrixTransform.py index e500b71c24..15a1b54d76 100644 --- a/tests/python/MatrixTransformTest.py +++ b/tests/python/test_MatrixTransform.py @@ -5,7 +5,7 @@ import PyOpenColorIO as OCIO -class MatrixTransformTest(unittest.TestCase): +class TestMatrixTransform(unittest.TestCase): def test_interface(self): """ diff --git a/tests/python/MixingHelpersTest.py b/tests/python/test_MixingHelpers.py similarity index 99% rename from tests/python/MixingHelpersTest.py rename to tests/python/test_MixingHelpers.py index 419831879b..097b583ed2 100644 --- a/tests/python/MixingHelpersTest.py +++ b/tests/python/test_MixingHelpers.py @@ -12,7 +12,7 @@ def helper_test_percent_1000(a, b): # Helper function to test sliders. return abs(a - int(100000 * b)) <= 1 -class MixingHelpersTest(unittest.TestCase): +class TestMixingHelpers(unittest.TestCase): def setUp(self): self.cfg = OCIO.Config().CreateFromStream(SAMPLE_CONFIG) diff --git a/tests/python/NamedTransformTest.py b/tests/python/test_NamedTransform.py similarity index 99% rename from tests/python/NamedTransformTest.py rename to tests/python/test_NamedTransform.py index 4e8b8e153a..f560f8d21a 100644 --- a/tests/python/NamedTransformTest.py +++ b/tests/python/test_NamedTransform.py @@ -48,7 +48,7 @@ """ -class NamedTransformTest(unittest.TestCase): +class TestNamedTransform(unittest.TestCase): TEST_NAME = 'namedTransform' TEST_FAMILY = 'myFamily' TEST_DESCRIPTION = 'used for tests' @@ -446,7 +446,7 @@ def test_processor_from_alias_and_context(self): self.assertEqual(group[0].getOffset(), self.OFFSET_INV) def test_processor_from_src_dst_name(self): - + cfg = OCIO.Config().CreateFromStream(SIMPLE_PROFILE) # Both named transform to display color space. diff --git a/tests/python/OCIOZArchiveTest.py b/tests/python/test_OCIOZArchive.py similarity index 95% rename from tests/python/OCIOZArchiveTest.py rename to tests/python/test_OCIOZArchive.py index b649badc93..e95ef83b7b 100644 --- a/tests/python/OCIOZArchiveTest.py +++ b/tests/python/test_OCIOZArchive.py @@ -13,21 +13,21 @@ import PyOpenColorIO as OCIO from UnitTestUtils import (SIMPLE_CONFIG, TEST_DATAFILES_DIR) -class ArchiveIsConfigArchivableTest(unittest.TestCase): +class TestArchiveIsConfigArchivable(unittest.TestCase): def setUp(self): """ Initialize the CONFIG """ self.CONFIG = OCIO.Config().CreateFromStream(SIMPLE_CONFIG) - # Since a working directory is needed to archive a config, setting a fake working directory + # Since a working directory is needed to archive a config, setting a fake working directory # in order to test the search paths and FileTransform source logic. if platform.system() == 'Windows': self.CONFIG.setWorkingDir('C:\\fake_working_dir') else: self.CONFIG.setWorkingDir('/fake_working_dir') self.CONFIG.validate() - + def tearDown(self): self.CONFIG = None @@ -47,7 +47,7 @@ def test_is_archivable(self): self.assertEqual(True, self.CONFIG.isArchivable()) self.CONFIG.setSearchPath('luts\myluts1') - self.assertEqual(True, self.CONFIG.isArchivable()) + self.assertEqual(True, self.CONFIG.isArchivable()) # Valid Search path starting with './' or '.\'. self.CONFIG.setSearchPath('./myLuts') @@ -96,7 +96,7 @@ def test_is_archivable(self): self.CONFIG.setSearchPath('luts:/$SHOT') self.assertEqual(False, self.CONFIG.isArchivable()) - + if platform.system() == 'Windows': self.CONFIG.clearSearchPaths() self.CONFIG.addSearchPath('C:\luts') @@ -169,7 +169,7 @@ def addFTAndTestIsArchivable(cfg, path, isArchivable): addFTAndTestIsArchivable(self.CONFIG, 'C:\\', False) addFTAndTestIsArchivable(self.CONFIG, 'C:\$SHOT', False) -class ArchiveContextTest(unittest.TestCase): +class TestArchiveContext(unittest.TestCase): def setUp(self): """ @@ -276,22 +276,22 @@ def test_cccid(self): look_transform = OCIO.LookTransform('reference', 'reference', 'shot_look') self.CONTEXT['CCCID'] = 'look-02' - processor = self.CONFIG.getProcessor(self.CONTEXT, - look_transform, + processor = self.CONFIG.getProcessor(self.CONTEXT, + look_transform, OCIO.TRANSFORM_DIR_FORWARD) cdl = processor.createGroupTransform()[0] self.assertEqual(cdl.getSlope()[0], 0.9) self.CONTEXT['CCCID'] = 'look-03' - processor = self.CONFIG.getProcessor(self.CONTEXT, - look_transform, + processor = self.CONFIG.getProcessor(self.CONTEXT, + look_transform, OCIO.TRANSFORM_DIR_FORWARD) cdl = processor.createGroupTransform()[0] self.assertEqual(cdl.getSlope()[0], 1.2) self.CONTEXT['CCCID'] = 'look-01' - processor = self.CONFIG.getProcessor(self.CONTEXT, - look_transform, + processor = self.CONFIG.getProcessor(self.CONTEXT, + look_transform, OCIO.TRANSFORM_DIR_FORWARD) cdl = processor.createGroupTransform()[0] self.assertEqual(cdl.getSlope()[0], 1.1) @@ -318,7 +318,7 @@ def setUp(self): self.ORIGNAL_ARCHIVED_CONFIG_PATH ) self.ORIGNAL_ARCHIVED_CONFIG.validate() - + def tearDown(self): self.CONFIG = None @@ -356,7 +356,7 @@ def test_archive_config_and_compare_to_original(self): def test_extract_config_and_compare_to_original(self): """ - Extract an OCIOZ archive that came from config X and create a new Config object Y with it, + Extract an OCIOZ archive that came from config X and create a new Config object Y with it, and then compare X and Y. """ # Testing CreateFromFile and ExtractOCIOZArchive on a successful path. @@ -369,7 +369,7 @@ def test_extract_config_and_compare_to_original(self): temp_dir_name = self.temp_ocioz_directory.name else: # Python 2. - temp_dir_name = tempfile.mkdtemp() + temp_dir_name = tempfile.mkdtemp() # 1 - Extract the OCIOZ archive to temporary directory. OCIO.ExtractOCIOZArchive(self.ORIGNAL_ARCHIVED_CONFIG_PATH, temp_dir_name) @@ -383,13 +383,13 @@ def test_extract_config_and_compare_to_original(self): # 3 - Compare config cacheID. ctx = self.ORIGNAL_ARCHIVED_CONFIG.getCurrentContext() self.assertEqual( - self.ORIGNAL_ARCHIVED_CONFIG.getCacheID(ctx), + self.ORIGNAL_ARCHIVED_CONFIG.getCacheID(ctx), new_config.getCacheID(ctx) ) # 4 - Compare a processor cacheID original_proc = self.ORIGNAL_ARCHIVED_CONFIG.getProcessor( - "plain_lut1_cs", + "plain_lut1_cs", "shot1_lut1_cs" ) new_proc = new_config.getProcessor("plain_lut1_cs", "shot1_lut1_cs") diff --git a/tests/python/OpenColorIOTest.py b/tests/python/test_OpenColorIO.py similarity index 95% rename from tests/python/OpenColorIOTest.py rename to tests/python/test_OpenColorIO.py index 0b6af12a24..c8f801ecee 100644 --- a/tests/python/OpenColorIOTest.py +++ b/tests/python/test_OpenColorIO.py @@ -9,7 +9,7 @@ import PyOpenColorIO as OCIO -class OpenColorIOTest(unittest.TestCase): +class TestOpenColorIO(unittest.TestCase): def test_env_variable(self): """ diff --git a/tests/python/ProcessorTest.py b/tests/python/test_Processor.py similarity index 99% rename from tests/python/ProcessorTest.py rename to tests/python/test_Processor.py index 2a989333e6..3c104525a9 100644 --- a/tests/python/ProcessorTest.py +++ b/tests/python/test_Processor.py @@ -7,7 +7,7 @@ from UnitTestUtils import TEST_DATAFILES_DIR -class ProcessorTest(unittest.TestCase): +class TestProcessor(unittest.TestCase): def test_is_noop(self): # Test isNoOp() function. diff --git a/tests/python/RangeTransformTest.py b/tests/python/test_RangeTransform.py similarity index 95% rename from tests/python/RangeTransformTest.py rename to tests/python/test_RangeTransform.py index ffd9ca20d9..3157c6d757 100644 --- a/tests/python/RangeTransformTest.py +++ b/tests/python/test_RangeTransform.py @@ -4,7 +4,7 @@ import unittest, os, sys import PyOpenColorIO as OCIO -class RangeTransformTest(unittest.TestCase): +class TestRangeTransform(unittest.TestCase): def test_range_transform_interface(self): """ @@ -95,7 +95,6 @@ def test_range_transform_equality(self): self.assertTrue(rt1.equals(rt2)) self.assertTrue(rt2.equals(rt1)) - def test_range_transform_validation(self): """ Test validate() function. diff --git a/tests/python/TransformsTest.py b/tests/python/test_Transforms.py similarity index 98% rename from tests/python/TransformsTest.py rename to tests/python/test_Transforms.py index 8a02e234e7..db785d8bd0 100644 --- a/tests/python/TransformsTest.py +++ b/tests/python/test_Transforms.py @@ -5,7 +5,7 @@ import PyOpenColorIO as OCIO import inspect -class TransformsTest(unittest.TestCase): +class TestTransforms(unittest.TestCase): def all_transforms_as_group(self): # Default arguments for Transforms that can't be instantiated without arguments. diff --git a/tests/python/TransformsBaseTest.py b/tests/python/test_TransformsBase.py similarity index 100% rename from tests/python/TransformsBaseTest.py rename to tests/python/test_TransformsBase.py diff --git a/tests/python/ViewTransformTest.py b/tests/python/test_ViewTransform.py similarity index 99% rename from tests/python/ViewTransformTest.py rename to tests/python/test_ViewTransform.py index b36b25463b..7cbc1b1fc9 100644 --- a/tests/python/ViewTransformTest.py +++ b/tests/python/test_ViewTransform.py @@ -4,7 +4,7 @@ import copy, unittest, os, sys import PyOpenColorIO as OCIO -class ViewTransformTest(unittest.TestCase): +class TestViewTransform(unittest.TestCase): def test_default_contructor(self): """ diff --git a/tests/python/ViewingRulesTest.py b/tests/python/test_ViewingRules.py similarity index 99% rename from tests/python/ViewingRulesTest.py rename to tests/python/test_ViewingRules.py index deba1e32d8..7660a5dbdb 100644 --- a/tests/python/ViewingRulesTest.py +++ b/tests/python/test_ViewingRules.py @@ -10,7 +10,7 @@ from UnitTestUtils import SIMPLE_CONFIG, TEST_NAMES -class ViewingRulesTest(unittest.TestCase): +class TestViewingRules(unittest.TestCase): def setUp(self): self.rules = OCIO.ViewingRules()