示例#1
0
 def test_content(self, test_channel):
     expected = [Package(("fail", "1.0.0")),
                 Package(("libsub", "1.0.0")),
                 Package(("libsub-dev", "1.0.0")),
                 Package(("success", "1.0.0"))]
     packages = test_channel.content()
     packages.sort()
     assert packages == expected
示例#2
0
    def test_run_test_scripts_pass(self, test_recipebook, mocker):
        test_env = "base"  # We need a valid environment for the mock
        mocker.patch("automation.package.Package.get_test_scripts",
                     return_value=["./tests/automation/succeed"])

        Package(("success", "1.0.0"),
                recipebook=test_recipebook).run_test_scripts(test_env)
示例#3
0
    def test_run_test_scripts_fail(self, test_recipebook, mocker):
        test_env = "base"  # We need a valid environment for the mock
        mocker.patch("automation.package.Package.get_test_scripts",
                     return_value=["./tests/automation/fail"])

        with pytest.raises(FailedTestError):
            Package(("fail", "1.0.0"),
                    recipebook=test_recipebook).run_test_scripts(test_env)
示例#4
0
    def test_ldd_pass(self, test_recipebook, mocker):
        test_env = "base"  # We need a valid environment for the mock
        test_path = "/home/ubuntu/miniconda3/envs/bin"
        ldd_result = "libsub.so.0 => /home/ubuntu/miniconda3/lib/libsub.so.0" \
                     " (0x00007ffee9523000)"

        mocker.patch('automation.package.run_command',
                     return_value=(ldd_result, "", 0))

        Package(("sub", "1.0.0"),
                recipebook=test_recipebook).check_ldd(test_path, test_env)
示例#5
0
def search_channels(channels: List[Channel], package_name: str = "",
                    override: bool = False) -> List[Package]:
    """Runs conda search in the given channels

    Args:
        channels: List of channels to search
        package_name: Package name to search for, gets all packages if not set
        override: Add override-channels option if true

    Returns: List[Package]
    """
    stdout, stderr, code = run_conda_command(Commands.SEARCH, channels,
                                             package_name,
                                             override=override)
    if code > 0:
        raise ChildProcessError(stderr)
    packages = []
    # remove title lines and final empty line
    for package in stdout.split("\n")[2:-1]:
        name, version, _, _ = package.split()
        packages.append(Package((name, version)))
    return packages
示例#6
0
 def test_sub_packages_recipebook(self, test_recipebook):
     assert Package(("sub", "1.0.0"),
                    recipebook=test_recipebook).\
                sub_packages() == {"libsub", "libsub-dev"}
示例#7
0
 def test_sub_packages_empty(self, test_recipebook):
     assert Package(("success", "1.0.0"),
                    recipebook=test_recipebook).sub_packages() == set()
示例#8
0
 def test_sub_packages_no_recipebook(self):
     with pytest.raises(PackageError,
                        match=r"^Cannot determine sub-packages"):
         Package(("sub", "1.0.0")).sub_packages()
示例#9
0
 def test_equals(self):
     assert Package(("success", "1.0.0")) == Package(("success", "1.0.0"))
     assert Package(("success", "1.0.0")) != Package(("fail", "1.0.0"))