Conversation
This required allowing tests to be decorated with '@environmentfilter'. Tests are essentially the same as filters now, the node, compiler, and environment have been refactored to extract common behavior.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1248 allowed deferring checking if a filter exists until runtime when writing the filter within in an if block. To make it easy to take advantage of such optionally available filters, this PR adds an
is filtertest.This required allowing tests to be decorated with
@environmentfilter. It's not clear why this wasn't allowed before. The docs mentioned it wasn't possible, but didn't give a justification. Perhaps the idea was that tests should be as simple as possible; if so that's up to the discretion of a project now.Tests are essentially the same as filters now. The difference is only the syntax used to call them and the namespace they're registered in. Most of the code in
nodes,compiler, andenvironmentis common between the two, so it was refactored to extract it. Tests won't be constant folded in volatile contexts. The compile supports async tests, but I'm not declaring that a public API yet, as there's not really any way to write them or apparent need for them yet. Like filters, undefined test names are checked at runtime in if blocks.Tests can be decorated with
environmentfunction,evalcontextfunction, andcontextfunction. Filters use{type}filterinstead but do exactly the same thing internally, which led me to open #1381 to pick one set of names.Checklist:
CHANGES.rstsummarizing the change and linking to the issue... versionchanged::entries in any relevant code docs.pre-commithooks and fix any issues.pytestandtox, no tests failed.