Skip to content

Commit

Permalink
Cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Jan 25, 2024
1 parent 2df618b commit 2fcf0f5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 142 deletions.
5 changes: 3 additions & 2 deletions tests/test_api_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from binstar_client.errors import NotFound
from conda.common.compat import on_linux, on_mac, on_win
from conda.exceptions import ClobberError, CondaMultiError
from conda_index.api import update_index
from pytest import FixtureRequest, MonkeyPatch
from pytest_mock import MockerFixture

Expand Down Expand Up @@ -533,7 +534,7 @@ def test_skip_existing_url(testing_metadata, testing_workdir, capfd):
copy_into(outputs[0], os.path.join(platform, os.path.basename(outputs[0])))

# create the index so conda can find the file
api.update_index(output_dir)
update_index(output_dir)

testing_metadata.config.skip_existing = True
testing_metadata.config.channel_urls = [url_path(output_dir)]
Expand Down Expand Up @@ -1467,7 +1468,7 @@ def test_run_constrained_stores_constrains_info(testing_config):
@pytest.mark.sanity
def test_no_locking(testing_config):
recipe = os.path.join(metadata_dir, "source_git_jinja2")
api.update_index(os.path.join(testing_config.croot))
update_index(os.path.join(testing_config.croot))
api.build(recipe, config=testing_config, locking=False)


Expand Down
39 changes: 0 additions & 39 deletions tests/test_api_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-License-Identifier: BSD-3-Clause
# This file makes sure that our API has not changed. Doing so can not be accidental. Whenever it
# happens, we should bump our major build number, because we may have broken someone.

import inspect
import sys
from inspect import getfullargspec as getargspec

Expand Down Expand Up @@ -183,40 +181,3 @@ def test_api_create_metapackage():
"config",
]
assert argspec.defaults == ((), None, 0, (), None, None, None, None)


def test_api_update_index():
# getfullargspec() isn't friends with functools.wraps
argspec = inspect.signature(api.update_index)
assert list(argspec.parameters) == [
"dir_paths",
"config",
"force",
"check_md5",
"remove",
"channel_name",
"subdir",
"threads",
"patch_generator",
"verbose",
"progress",
"hotfix_source_repo",
"current_index_versions",
"kwargs",
]
assert tuple(parameter.default for parameter in argspec.parameters.values()) == (
inspect._empty,
None,
False,
False,
False,
None,
None,
None,
None,
False,
False,
None,
None,
inspect._empty,
)
9 changes: 0 additions & 9 deletions tests/test_conda_interface.py

This file was deleted.

1 change: 0 additions & 1 deletion tests/test_subpackages.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def test_run_exports_in_subpackage(testing_metadata):
p1 = testing_metadata.copy()
p1.meta["outputs"] = [{"name": "has_run_exports", "run_exports": "bzip2 1.0"}]
api.build(p1, config=testing_metadata.config)[0]
# api.update_index(os.path.dirname(output), config=testing_metadata.config)
p2 = testing_metadata.copy()
p2.meta["requirements"]["host"] = ["has_run_exports"]
p2_final = finalize_metadata(p2)
Expand Down
91 changes: 0 additions & 91 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,97 +79,6 @@ def test_disallow_in_tree_merge(testing_workdir):
utils.merge_tree(testing_workdir, os.path.join(testing_workdir, "subdir"))


def test_relative_default():
for f, r in [
("bin/python", "../lib"),
("lib/libhdf5.so", "."),
("lib/python2.6/foobar.so", ".."),
("lib/python2.6/lib-dynload/zlib.so", "../.."),
("lib/python2.6/site-packages/pyodbc.so", "../.."),
("lib/python2.6/site-packages/bsdiff4/core.so", "../../.."),
("xyz", "./lib"),
("bin/somedir/cmd", "../../lib"),
]:
assert utils.relative(f) == r


def test_relative_lib():
for f, r in [
("bin/python", "../lib"),
("lib/libhdf5.so", "."),
("lib/python2.6/foobar.so", ".."),
("lib/python2.6/lib-dynload/zlib.so", "../.."),
("lib/python2.6/site-packages/pyodbc.so", "../.."),
("lib/python2.6/site-packages/bsdiff3/core.so", "../../.."),
("xyz", "./lib"),
("bin/somedir/cmd", "../../lib"),
("bin/somedir/somedir2/cmd", "../../../lib"),
]:
assert utils.relative(f, "lib") == r


def test_relative_subdir():
for f, r in [
("lib/libhdf5.so", "./sub"),
("lib/sub/libhdf5.so", "."),
("bin/python", "../lib/sub"),
("bin/somedir/cmd", "../../lib/sub"),
]:
assert utils.relative(f, "lib/sub") == r


def test_relative_prefix():
for f, r in [
("xyz", "."),
("a/xyz", ".."),
("a/b/xyz", "../.."),
("a/b/c/xyz", "../../.."),
("a/b/c/d/xyz", "../../../.."),
]:
assert utils.relative(f, ".") == r


def test_relative_2():
for f, r in [
("a/b/c/d/libhdf5.so", "../.."),
("a/b/c/libhdf5.so", ".."),
("a/b/libhdf5.so", "."),
("a/libhdf5.so", "./b"),
("x/x/libhdf5.so", "../../a/b"),
("x/b/libhdf5.so", "../../a/b"),
("x/libhdf5.so", "../a/b"),
("libhdf5.so", "./a/b"),
]:
assert utils.relative(f, "a/b") == r


def test_relative_3():
for f, r in [
("a/b/c/d/libhdf5.so", ".."),
("a/b/c/libhdf5.so", "."),
("a/b/libhdf5.so", "./c"),
("a/libhdf5.so", "./b/c"),
("libhdf5.so", "./a/b/c"),
("a/b/x/libhdf5.so", "../c"),
("a/x/x/libhdf5.so", "../../b/c"),
("x/x/x/libhdf5.so", "../../../a/b/c"),
("x/x/libhdf5.so", "../../a/b/c"),
("x/libhdf5.so", "../a/b/c"),
]:
assert utils.relative(f, "a/b/c") == r


def test_relative_4():
for f, r in [
("a/b/c/d/libhdf5.so", "."),
("a/b/c/x/libhdf5.so", "../d"),
("a/b/x/x/libhdf5.so", "../../c/d"),
("a/x/x/x/libhdf5.so", "../../../b/c/d"),
("x/x/x/x/libhdf5.so", "../../../../a/b/c/d"),
]:
assert utils.relative(f, "a/b/c/d") == r


def test_expand_globs(testing_workdir):
sub_dir = os.path.join(testing_workdir, "sub1")
os.mkdir(sub_dir)
Expand Down

0 comments on commit 2fcf0f5

Please sign in to comment.