Skip to content

Commit

Permalink
clean up with-chdir test
Browse files Browse the repository at this point in the history
  • Loading branch information
atalii committed Oct 26, 2023
1 parent fda16e3 commit cba2c11
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions testsuite/tests/init/with-chdir/test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
"""
Test "executable" only appears in --bin initializations
Test --chdir switch.
"""

import os.path
import os

from drivers.alr import run_alr
from drivers.asserts import assert_match
from drivers.helpers import content_of

test_dir = os.getcwd()

# Binary crate
# Make a binary crate in test that it runs without cd'ing.
run_alr("init", "--bin", "xxx")
assert_match(".*executables = \[", content_of("xxx/alire.toml"))

# Check that it builds and runs
run_alr("--chdir=xxx", "run")

# Test that changing to a non-existent directory fails. Technically,
# /dev/null/cantexist can exist, but it's more than reasonable to assume a
# system with this directory has bigger issues.
bad_chdir = run_alr("-C", "/dev/null/cantexist", "run", complain_on_error=False)
assert_match(".*directory \"/dev/null/cantexist\" does not exist.*", bad_chdir.out)

print('SUCCESS')

0 comments on commit cba2c11

Please sign in to comment.