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

Support for file/files in JVM tests #14537

Merged

Conversation

chrisjrn
Copy link
Contributor

This is largely based on the golang approach, and most of the code here is tests, for some reason :)

Closes #14524

Christopher Neugebauer added 5 commits February 18, 2022 13:10
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@chrisjrn chrisjrn changed the title Support for file/files/relocated_files` in JVM tests Support for file/files/relocated_files in JVM tests Feb 18, 2022
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@chrisjrn
Copy link
Contributor Author

relocated_files support has a failing test. It looks like the relevant source files aren't hydrated into the relevant snapshot

@chrisjrn chrisjrn changed the title Support for file/files/relocated_files in JVM tests Support for file/files in JVM tests Feb 18, 2022
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@chrisjrn
Copy link
Contributor Author

I've marked relocated_files support as skipped, a fix is presently blocked on #14538.

Copy link
Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks, looks good!

) -> FallibleClasspathEntry:

return FallibleClasspathEntry(
"Empty classpath for no-op classpath target",
Copy link
Member

Choose a reason for hiding this comment

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

To make for more useful debug logging, this description should probably still include str(request.component).

Comment on lines 615 to 616
@maybe_skip_jdk_test
def test_vintage_file_dependency(rule_runner: RuleRunner) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

It would be good to extract a test helper across these three methods... maybe something that takes the BUILD file content and the final filename to expect as arguments...?

assert re.search(r"1 tests found", test_result.stdout) is not None


@pytest.mark.skip # TODO(14537) `relocated_files` doesn't presently work, un-skip when fixing that.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@pytest.mark.skip # TODO(14537) `relocated_files` doesn't presently work, un-skip when fixing that.
@pytest.mark.skip("TODO(14537) `relocated_files` doesn't presently work, un-skip when fixing that.")

Hm, yea: inspecting this, I don't see any reason why it shouldn't already be working. But given the further work that will be happening with codegen (and it being slightly off topic) deferring it makes good sense.

JdkEnvironment, JdkRequest, JdkRequest.from_field(request.field_set.jdk_version)
jdk, dependencies = await MultiGet(
Get(JdkEnvironment, JdkRequest, JdkRequest.from_field(request.field_set.jdk_version)),
Get(Targets, DependenciesRequest(request.field_set.dependencies)),
Copy link
Member

Choose a reason for hiding this comment

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

(applies to both implementations)

One thing to think about here is whether this should be for direct or transitive dependencies. In v1 for JVM it was transitive, which has the advantage of being able to declare test helpers in other targets with their own files target dependencies (a test helper using a yaml file, for example). I know less about the semantics of Go though, and whether it would be useful (or even possible) to be transitive in that case cc @Eric-Arellano , @tdyas.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. Perhaps we land the version with direct dependencies and return to the topic of transitive dependencies later?

Christopher Neugebauer added 2 commits February 22, 2022 10:07
# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]

# Building wheels and fs_util will be skipped. Delete if not intended.
[ci skip-build-wheels]
@chrisjrn chrisjrn enabled auto-merge (squash) February 22, 2022 18:10
@chrisjrn chrisjrn merged commit 9455880 into pantsbuild:main Feb 22, 2022
alonsodomin pushed a commit to alonsodomin/pants that referenced this pull request Feb 25, 2022
This is largely based on the `golang` approach. Presently `relocated_files` support is broken (at least in tests, it's not immediately clear why)

 Closes pantsbuild#14524
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.

Add support for files in scalatest/junit
2 participants