Skip to content

Conversation

@grynspan
Copy link
Contributor

Because SwiftPM is not (yet) aware of swift-testing, swift test --filter does not have any effect on swift-testing tests. This PR adds temporary support for an environment variable, "SWT_SELECTED_TEST_IDS", to stand in for --filter until such time as SwiftPM can be modified to support swift-testing.

Note that the supported value of this environment variable is (intentionally) constrained to just test IDs right now. Matching display names or other metadata about tests is certainly possible, but it's beyond the scope of today's PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just some editorial cleanup here.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks!

@grynspan grynspan force-pushed the jgrynspan/filter-envvar branch from 1459089 to 073c5df Compare October 23, 2023 16:25
@grynspan
Copy link
Contributor Author

@swift-ci please test

Because SwiftPM is not (yet) aware of swift-testing, `swift test --filter` does not have any effect on swift-testing tests. This PR adds temporary support for an environment variable, `"SWT_SELECTED_TEST_IDS"`, to stand in for `--filter` until such time as SwiftPM can be modified to support swift-testing.

Note that the supported value of this environment variable is (intentionally) constrained to just test IDs right now. Matching display names or other metadata about tests is certainly possible, but it's beyond the scope of today's PR.
@grynspan grynspan force-pushed the jgrynspan/filter-envvar branch from 073c5df to 1e4dbd2 Compare October 23, 2023 17:35
@grynspan grynspan requested a review from stmontgomery October 23, 2023 17:37
@grynspan
Copy link
Contributor Author

@swift-ci please test

@grynspan grynspan merged commit aae1fee into main Oct 23, 2023
@grynspan grynspan deleted the jgrynspan/filter-envvar branch October 23, 2023 17:50
grynspan added a commit that referenced this pull request Oct 24, 2023
This PR is a follow-on to #77. It adds the ability to filter tests to just the ones that contain a given tag using an environment variable. As before, `swift test --filter` is unaware of swift-testing, so we need a temporary solution until such time as `swift test` is taught about us.

To try it out:

```
SWT_SELECTED_TAGS='trait' swift test
```

Will run only those tests with the `"trait"` tag.

If both `"SWT_SELECTED_TAGS""` and `"SWT_SELECTED_TEST_IDS"` are specified, a test must have (at least one of) the given tags _and_ be selected by ID. Whether or not this is the right way to combine these environment variables is, to be polite, probably uninteresting since this is not meant to be a permanent solution.

This change also implements `==` and `hash(into:)` on `Tag` as they were previously synthesized which would cause them to consider the internal `sourceCode` property, which was not intentional.
@stmontgomery stmontgomery added the enhancement New feature or request label Oct 25, 2023
grynspan added a commit that referenced this pull request Oct 25, 2023
This PR is a follow-on to #77. It adds the ability to filter tests to just the ones that contain a given tag using an environment variable. As before, `swift test --filter` is unaware of swift-testing, so we need a temporary solution until such time as `swift test` is taught about us.

To try it out:

```
SWT_SELECTED_TAGS='trait' swift test
```

Will run only those tests with the `"trait"` tag.

If both `"SWT_SELECTED_TAGS""` and `"SWT_SELECTED_TEST_IDS"` are specified, a test must have (at least one of) the given tags _and_ be selected by ID. Whether or not this is the right way to combine these environment variables is, to be polite, probably uninteresting since this is not meant to be a permanent solution.

This change also implements `==` and `hash(into:)` on `Tag` as they were previously synthesized which would cause them to consider the internal `sourceCode` property, which was not intentional.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants