Skip to content

Commit

Permalink
-added testing for preprocessing, and build-time package.py code sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohns committed Mar 1, 2017
1 parent 31760f0 commit 1aac3ee
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/rez/tests/data/packages/developer_dynamic/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ def description():
requires = [
"versioned-*"
]

def preprocess(this, data):
from early_utils import get_authors
data["authors"] = get_authors()
Empty file.
6 changes: 6 additions & 0 deletions src/rez/tests/data/python/early_bind/early_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

def get_authors():
return [
"tweedle-dee",
"tweedle-dum"
]
10 changes: 8 additions & 2 deletions src/rez/tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,15 @@ def setUpClass(cls):
cls.yaml_packages_path = os.path.join(cls.packages_base_path, "yaml_packages")
cls.py_packages_path = os.path.join(cls.packages_base_path, "py_packages")

cls.package_definition_build_python_paths = [
os.path.join(path, "data", "python", "early_bind")
]

cls.settings = dict(
packages_path=[cls.solver_packages_path,
cls.yaml_packages_path,
cls.py_packages_path],
package_definition_build_python_paths=cls.package_definition_build_python_paths,
package_filter=None)

@classmethod
Expand Down Expand Up @@ -187,13 +192,14 @@ def test_5(self):
data = package.validated_data()
self.assertDictEqual(data, expected_data)

# a developer package with features such as expanding requirements
# and early-binding attribute functions
# a developer package with features such as expanding requirements,
# early-binding attribute functions, and preprocessing
path = os.path.join(self.packages_base_path, "developer_dynamic")
package = get_developer_package(path)

self.assertEqual(package.description, "This.")
self.assertEqual(package.requires, [PackageRequest('versioned-3')])
self.assertEqual(package.authors, ["tweedle-dee", "tweedle-dum"])

def test_6(self):
"""test variant iteration."""
Expand Down

0 comments on commit 1aac3ee

Please sign in to comment.