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 testkit on sbt launching tests defined in other test modules when depending on another test artifact #2052

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

neko-kai
Copy link
Member

This workaround alters the classpath scanning logic to only consider classes defined in the first test-classes directory encountered on the classpath to be those defined in 'current module'. It seems that for SBT the heuristic that the current test module classes will be placed in the first test-classes dir on the classpath generally holds. However, if it fails, you may be able to fix test running by overriding _sbtIsClassDefinedInCurrentTestModule or _sbtFindCurrentTestModuleClasspathElement in your tests to suit your needs.

Also fix DistageScalatestTestSuiteRunner#modifyClasspathScan modifier not being applied (it was never applied, ugh...)

… depending on another test artifact

This workaround alters the classpath scanning logic to only consider classes defined in the first `test-classes` directory
encountered on the classpath to be those defined in 'current module'. It seems that for SBT the heuristic that the current test module
classes will be placed in the first `test-classes` dir on the classpath generally holds. However, if it fails, you may be able to fix
test running by overriding `_sbtIsClassDefinedInCurrentTestModule` or `_sbtFindCurrentTestModuleClasspathElement` in your tests to suit
your needs.


Also fix `DistageScalatestTestSuiteRunner#modifyClasspathScan` modifier not being applied (it was never applied, ugh...)
@neko-kai neko-kai requested a review from Caparow January 15, 2024 21:43
@neko-kai neko-kai merged commit 1f264a4 into develop Jan 17, 2024
31 checks passed
@neko-kai neko-kai deleted the feature/fix-sbt-test-module-filtering branch January 17, 2024 16:08
neko-kai added a commit that referenced this pull request Jan 19, 2024
- Make path comparisons less strict
  - Regression was caused by some classpath elements containing trailing / non-deterministically
- Print a diagnostic message if test class filtering occured
neko-kai added a commit that referenced this pull request Jan 19, 2024
- Make path comparisons less strict
  - Regression was caused by some classpath elements containing trailing `/` non-deterministically
- Print a diagnostic message if test class filtering occured
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.

1 participant