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

we need to cd to the final destination even if source fails #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,35 @@ def test_cd_dash(venv_path, tmpdir, shell):
venv2=str(venv2),
)
run_test(shell, test, tmpdir)


def test_broken_activate(venv_path, tmpdir, shell):
"""When a activate script doesn't work, aactivator keeps trying it,
but you can still cd within the project.
"""
make_venv_in_tempdir(tmpdir)
venv_path.join('.activate.sh').write("echo '(activation failure)'; false")

test = '''\
TEST> eval "$(aactivator init)"
TEST> cd {venv_path}/child-dir
aactivator will source .activate.sh and .deactivate.sh at {venv_path}.
Acceptable? (y)es (n)o (N)ever: INPUT> y
aactivator will remember this: ~/.cache/aactivator/allowed
(activation failure)
TEST> pwd
{venv_path}/child-dir
(activation failure)
TEST> cd ..
(activation failure)
TEST> pwd
{venv_path}
(activation failure)
TEST> cd ..
TEST> echo ok
ok
'''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When run in master, this test gives:

E           AssertionError: Incorrect output.
E           >>> Context:
E           TEST> 
E           >>> Expected:
E               pwd
E               /tmp/buck/pytest-of-buck/pytest-13/test_broken_activate_shell1_0/venv/child-dir
E               (activation failure)
E               
E           >>> Actual:
E               pwd
E               /tmp/buck/pytest-of-buck/pytest-13/test_broken_activate_shell1_0/venv
E               (activation failure)
E               TEST>

test = test.format(
venv_path=str(venv_path),
)
run_test(shell, test, tmpdir)