Skip to content

Convert python wheel tests to acceptance - #2396

Merged
denik merged 50 commits into
mainfrom
denik/acc-python-wheel
Mar 3, 2025
Merged

Convert python wheel tests to acceptance#2396
denik merged 50 commits into
mainfrom
denik/acc-python-wheel

Conversation

@denik

@denikdenik commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

Changes

Rewrite bundle/tests/python_wheel_test.go into acceptance tests. The same configs are used, but the test now runs 'bundle deploy' and in addition to checking the files on the file system, also checks that the files were uploaded and records jobs/create request.

There is a new test helper bin/find.py which filters out paths based on regex, asserts on number of expected results. I've added it because 'find' on Windows behaves differently, so this helps avoid cross-platform differences.

@denik
denik marked this pull request as draft February 27, 2025 12:00
@denik
denik changed the base branch from main to denik/acc-improve-404February 27, 2025 12:22
@denik
denikforce-pushed the denik/acc-improve-404 branch from cb5d4d6 to 18515e8CompareFebruary 27, 2025 12:24
@denik
denikforce-pushed the denik/acc-python-wheel branch from a74be26 to db270e3CompareFebruary 27, 2025 12:35
@denik
denikforce-pushed the denik/acc-python-wheel branch from 852e8ec to db270e3CompareFebruary 27, 2025 13:10
Base automatically changed from denik/acc-improve-404 to mainFebruary 27, 2025 13:16
@denik
denikforce-pushed the denik/acc-python-wheel branch from a8d2479 to 916021cCompareFebruary 27, 2025 13:31
@denik
denikforce-pushed the denik/acc-python-wheel branch from 270677e to be7b6a9CompareFebruary 28, 2025 10:41
@denik
denikforce-pushed the denik/acc-python-wheel branch from 60c5697 to fe50cb1CompareFebruary 28, 2025 15:02
@denik
denik marked this pull request as ready for review February 28, 2025 16:33

@pieternpietern left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Leaving the stamp of approval to @andrewnester.


if args.expect is not None:
if args.expect != len(result):
sys.exit(f"Expected {args.expect}, got {len(result)}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The inclusion of an expectation in this command feels off.

Could we compose this with a function/command/helper that asserts on the number of lines in an output?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Well, this is not a generic command, this is an acceptance test helper. Given its narrow context, I think it's okay.

If we see more use cases where a separate line-counting script would makes things simpler, we can always extract that.

type: whl
path: "./my_test_code"
build: "python3 setup.py bdist_wheel"
build: python setup.py bdist_wheel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is python3 not aliased?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

There is no 'python3' in virtualenv on Windows (as we learned in #2034).

Deployment complete!
Updating deployment state...
Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/python-wheel/default/files...
Uploading my_test_code-0.0.1-py3-none-any.whl...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The order is a bit confusing now, shall we do the package name replacement instead in these lines and then the output will be determenistic?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I agree it's not ideal. I see this as -- we record a set of steps to be taken, ignoring the order.

do the package name replacement

I'd rather see the names, given that we focus on multiple wheels being supported there. If we replace both, we won't catch situation if it uploaded one wheel twice instead of two separate wheels once.

@denik
denik added this pull request to the merge queueMar 3, 2025
Merged via the queue into main with commit 8f8f24cMar 3, 2025
@denik
denik deleted the denik/acc-python-wheel branch March 3, 2025 11:17
denik added a commit that referenced this pull request May 20, 2026
Ignore output files using gitignore syntax.
## Changes
New Ignore setting in test.toml that will ignore specified files (syntax
is gitignore).
## Why
I'm using it in #2396 to ignore virtual env. It includes a lot of files.
The regular 'rm -fr .venv' approach only works if script get to that
point, but due to errors it might abort early. In that cases test runner
prints all unexpected files, polluting output. Ignoring those files at
test runner level ensure you never see them.
## Tests
Updated selftest/basic.
denik added a commit that referenced this pull request May 20, 2026
## Changes
Rewrite bundle/tests/python_wheel_test.go into acceptance tests. The
same configs are used, but the test now runs 'bundle deploy' and in
addition to checking the files on the file system, also checks that the
files were uploaded and records jobs/create request.
There is a new test helper bin/find.py which filters out paths based on
regex, asserts on number of expected results. I've added it because
'find' on Windows behaves differently, so this helps avoid
cross-platform differences.
Sign up for freeto 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.

3 participants

@denik@pietern@andrewnester