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

assert-test-is-not-parallel does not work inside fixtures #26

Open
camsaul opened this issue May 16, 2024 · 0 comments
Open

assert-test-is-not-parallel does not work inside fixtures #26

camsaul opened this issue May 16, 2024 · 0 comments

Comments

@camsaul
Copy link
Member

camsaul commented May 16, 2024

From metabase/metabase#26843

My original description:

We have logic to make sure you don't do things like with-redefs inside ^:parallel tests. We do this by swapping out clojure.core/test-var with a version that binds a *parallel? dynamic var, and that's what assert-test-is-not-parallel checks. However, this doesn't affect :each fixtures, since the each fixture logic happens before test-var ever gets called...

I think we need to intercept clojure.test/test-vars as well and maybe wrap the :each fixtures to bind *parallel?* to get it to work properly... I tried this but it's a little tricky because the :each fixtures don't get passed the vars themselves, but get passed the test function (:test metadata on the var). Figuring out how to do this will be a little tricky, but ultimately doable I think

@bshepherdson also suggested

Perhaps we can check this in both directions - keep the test-var logic we have, plus cause parallel-unsafe things like with-redefs to set another dynamic var that gets checked on the way in to a test-var. Then if a fixture has already done something unsafe, but we're starting a parallel test, we can assert.

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

No branches or pull requests

1 participant