Skip to content

Commit

Permalink
-Remove pytest.ini.
Browse files Browse the repository at this point in the history
-Remove pytest component of pyproject.toml.
-Conform tests to pytest naming convention.

Signed-off-by: Mei Chu <[email protected]>
  • Loading branch information
meimchu committed Jan 25, 2023
1 parent c384532 commit 7c9d6ab
Show file tree
Hide file tree
Showing 48 changed files with 221 additions and 240 deletions.
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
10 changes: 0 additions & 10 deletions pytest.ini

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/python/BakerTest.py → tests/python/test_Baker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import PyOpenColorIO as OCIO

class BuiltinConfigRegistryTest(unittest.TestCase):
class TestBuiltinConfigRegistry(unittest.TestCase):
# BuiltinRegistry singleton.
REGISTRY = None

Expand All @@ -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))
Expand All @@ -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)):
Expand Down Expand Up @@ -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)):
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from UnitTestUtils import STRING_TYPES


class BuiltinTransformRegistryTest(unittest.TestCase):
class TestBuiltinTransformRegistry(unittest.TestCase):
# BuiltinTransformRegistry singleton
REGISTRY = None

Expand All @@ -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)):
Expand Down Expand Up @@ -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)):
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading

0 comments on commit 7c9d6ab

Please sign in to comment.