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

Use Bats work dir by default #717

Merged
merged 3 commits into from
Nov 11, 2019
Merged

Conversation

AirQuick
Copy link
Member

@AirQuick AirQuick commented Nov 9, 2019

Fixes #583

The current Bats script creates XSpec output directories here and there inside the repository, and deletes them later. That doesn't scale.
This pull request directs XSpec CLI and Ant to use a common work directory outside the repository.

Current master

xspec/test/xspec.bats

Lines 20 to 36 in 5c90152

setup() {
work_dir="${BATS_TMPDIR}/xspec/bats_work"
mkdir -p "${work_dir}"
mkdir ../test/catalog/xspec
mkdir ../test/xspec
mkdir ../tutorial/schematron/xspec
mkdir ../tutorial/xspec
}
teardown() {
rm -rf "${work_dir}"
rm -rf ../test/catalog/xspec
rm -rf ../test/xspec
rm -rf ../tutorial/schematron/xspec
rm -rf ../tutorial/xspec
}

This pull request

xspec/test/xspec.bats

Lines 24 to 34 in f9eac48

setup() {
work_dir="${BATS_TMPDIR}/xspec/bats_work"
mkdir -p "${work_dir}"
export TEST_DIR="${work_dir}/output_${RANDOM}"
export ANT_ARGS="-Dxspec.dir=${TEST_DIR}"
}
teardown() {
rm -r "${work_dir}"
}

Also

  • Some other adjustments are made throughout the Bats script.
  • Some test cases are added.

Further work

Remove If you earlier ran tests manually without removing the temporary... from Wiki.

@AirQuick AirQuick added the test label Nov 9, 2019
@AirQuick AirQuick added this to the v1.5.0 milestone Nov 9, 2019
@AirQuick
Copy link
Member Author

Merging this, because we know from experience that leaving this kind of pull request pending will result in unmanageable conflicts.

@AirQuick AirQuick merged commit 7379412 into xspec:master Nov 11, 2019
@AirQuick AirQuick deleted the bats-default-work-dir branch November 11, 2019 16:43
@AirQuick
Copy link
Member Author

@xspec/xspec

Further work

Remove If you earlier ran tests manually without removing the temporary... from Wiki.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bats test fails when output dir exists
1 participant