Skip to content

fix(testing): don't change the output artifact location #758

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cmatsuoka
Copy link
Contributor

When running the test command, create the output artifact in the
standard output location instead of moving it to the spread
subdirectory.

Fixes #752

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint && make test?
  • Have you added an entry to the changelog (docs/reference/changelog.rst)?

When running the `test` command, create the output artifact in the
standard output location instead of moving it to the spread
subdirectory.

Fixes canonical#752

Signed-off-by: Claudio Matsuoka <[email protected]>
@cmatsuoka cmatsuoka requested review from tigarmo and lengau May 7, 2025 19:48
# Output into the spread directory.
parsed_args.output = pathlib.Path.cwd() / "spread"
parsed_args.output.mkdir(exist_ok=True)
parsed_args.fetch_service_policy = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about this fetch service policy change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lengau Why was this change needed when changing the output directory?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The policy change was unrelated - we were just setting it so when the pack command checks for it, it would still be set.

@@ -482,10 +482,6 @@ def _run(

if parsed_args.test_path:
testing_service.validate_tests(parsed_args.test_path)
# Output into the spread directory.
parsed_args.output = pathlib.Path.cwd() / "spread"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really address the fact that the testing command doesn't support the output parameter right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need further discussion. We need to test the artifact generated by pack, and this is not possible if output points to somewhere outside the project tree.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mean outputs outside of the project tree, because we can't pack those anyway. I mean outputs that are subdirectories of the project dir. For example, you removed this hardcoded setting but what if the user does snapcraft test --output=spread/ ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--output isn't in the argument parser for the test command so that will give a usage error.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah alright then!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test command should not modify output location
3 participants