Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for when args.path is not used #90

Merged
merged 4 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion extensions/commands/cci/cmd_export_all_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def export_all_versions(conan_api, parser, *args):
folders_to_export = item[recipe_name][0]['folders'] if isinstance(item, dict) else None
out.verbose(f"Processing recipe '{recipe_name}'")

recipe_folder = os.path.join(args.path, recipe_name)
recipe_folder = os.path.join(args.path, recipe_name) if args.path is not None else os.path.join(f"{os.getcwd()}/recipes", recipe_name)
if not os.path.isdir(recipe_folder):
raise ConanException(f"Invalid user input: '{recipe_name}' does not exist or is not a dir")

Expand Down
22 changes: 20 additions & 2 deletions tests/test_export_all_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def conan_test():
os.environ.clear()
os.environ.update(old_env)


def test_convert_txt():
@pytest.fixture(autouse=True)
def create_dummy_recipe_and_file_tree():
repo = os.path.join(os.path.dirname(__file__), "..")
run(f"conan config install {repo}")
run("conan --help")
Expand Down Expand Up @@ -53,6 +53,24 @@ class Pkg(ConanFile):
os.mkdir("recipes/pkgb/all")
save("recipes/pkgb/all/conanfile.py", conanfile % "pkgb")

def test_path_arg():
run("conan cci:export-all-versions -p recipes")

assert len(os.listdir(os.path.join(os.environ.get("CONAN_HOME"), "p"))) == 6

def test_list_arg():
list_yml = """
recipes:
- pkga
- pkgb
"""

save("list.yml", list_yml)

run("conan cci:export-all-versions -l list.yml")
assert len(os.listdir(os.path.join(os.environ.get("CONAN_HOME"), "p"))) == 6

def test_name_arg():
run("conan cci:export-all-versions -n pkga")
assert len(os.listdir(os.path.join(os.environ.get("CONAN_HOME"), "p"))) == 4