Created
May 22, 2021 15:03
-
-
Save davidlatwe/a4bc47e7d9e80dc43b47b1afe5a40e94 to your computer and use it in GitHub Desktop.
Test improving Rez context resolve failure messsage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from rez.resolved_context import ResolvedContext | |
from rez.package_repository import package_repository_manager | |
os.environ["REZ_PACKAGES_PATH"] = "memory@any" | |
class Repo(object): | |
def __init__(self): | |
self._repo = package_repository_manager.get_repository("memory@any") | |
def add(self, name, **kwargs): | |
version = kwargs.get("version", "_NO_VERSION") | |
if name not in self._repo.data: | |
self._repo.data[name] = dict() | |
self._repo.data[name].update({ | |
version: dict(name=name, **kwargs) | |
}) | |
def test_conflict(): | |
repo = Repo() | |
repo.add("bar", version="1", requires=["dep==2"]) | |
repo.add("foo", version="1", requires=["dep==1"]) | |
repo.add("dep", version="1") | |
repo.add("dep", version="2") | |
context = ResolvedContext(["foo", "bar"]) | |
context.print_info() | |
def test_conflict_pipeline(): | |
repo = Repo() | |
repo.add("pipeline", version="1", requires=["maya-2018+<=2020"]) | |
repo.add("maya", version="2020", requires=["pymel"]) | |
repo.add("pymel", version="2", requires=["python-2"]) | |
repo.add("houdini", version="18", requires=["python-3"]) | |
repo.add("python", version="2") | |
repo.add("python", version="3") | |
context = ResolvedContext(["pipeline", "maya", "houdini-18"]) | |
context.print_info() | |
def test_big_cycle(): | |
repo = Repo() | |
repo.add("pipeline", version="0", requires=["nuke-10"]) | |
repo.add("nuke", version="10", requires=["cycle", "python==3"]) | |
repo.add("python", version="3") | |
repo.add("cycle", version="1", requires=["bigger"]) | |
repo.add("bigger", version="5", requires=["nuke"]) | |
context = ResolvedContext(["pipeline", "cycle"]) | |
context.print_info() | |
if __name__ == "__main__": | |
# test_conflict() | |
# test_conflict_pipeline() | |
test_big_cycle() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment