You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I submitted PR #19 to use $BATS_RUN_TMPDIR for $BATS_MOCK_TMPDIR. That fixes accidentally not unstubbing. But with or without it, I realized since submitting the PR that another issue remains.
If I run a large suite of Bats tests (say, >1,000) in job parallel mode, the stubs interfere with each other and cause errors since they're all set in the run tmpdir and have no separation from each other.
I have taken to patching in $BATS_FILE_TMPDIR instead. Then at least I can disable parallelization in the individual Bats files where I use bats-mock (with export BATS_NO_PARALLELIZE_WITHIN_FILE=true) and still get parallelization across the other test files.
The other option is to set $BATS_MOCK_TMPDIR to $BATS_TEST_TMPDIR... however, that prevents people from doing a stub in the file setup() function and unstub in the file teardown() function. But it allows for parallelization within Bats test files that use bats-mock.
I prefer $BATS_FILE_TMPDIR and use sed to patch it in bc of the control I retain in the current big bash project I'm working on. But the next project might mean that I'm patching in $BATS_TEST_TMPDIR due to high bats-mock usage and need for parallelization.
There doesn't seem to be a good answer here, only a design decision to be made and documentation on the limitations/requirements. As such, I defer to you as owners.
The text was updated successfully, but these errors were encountered:
Hi. I submitted PR #19 to use
$BATS_RUN_TMPDIR
for$BATS_MOCK_TMPDIR
. That fixes accidentally notunstub
bing. But with or without it, I realized since submitting the PR that another issue remains.If I run a large suite of Bats tests (say, >1,000) in job parallel mode, the stubs interfere with each other and cause errors since they're all set in the run tmpdir and have no separation from each other.
I have taken to patching in
$BATS_FILE_TMPDIR
instead. Then at least I can disable parallelization in the individual Bats files where I usebats-mock
(withexport BATS_NO_PARALLELIZE_WITHIN_FILE=true
) and still get parallelization across the other test files.The other option is to set
$BATS_MOCK_TMPDIR
to$BATS_TEST_TMPDIR
... however, that prevents people from doing astub
in the filesetup()
function andunstub
in the fileteardown()
function. But it allows for parallelization within Bats test files that usebats-mock
.I prefer
$BATS_FILE_TMPDIR
and usesed
to patch it in bc of the control I retain in the current big bash project I'm working on. But the next project might mean that I'm patching in$BATS_TEST_TMPDIR
due to highbats-mock
usage and need for parallelization.There doesn't seem to be a good answer here, only a design decision to be made and documentation on the limitations/requirements. As such, I defer to you as owners.
The text was updated successfully, but these errors were encountered: