Skip to content

Commit

Permalink
Force unicode; find virtualenvwrapper.sh path
Browse files Browse the repository at this point in the history
  • Loading branch information
jayqi committed Mar 6, 2020
1 parent bb0a3ab commit 8796b06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_baking_configs(config):
verify_folders(project_directory, config)
verify_files(project_directory, config)
verify_makefile_commands(project_directory, config)


def verify_folders(root, config):
''' Tests that expected folders and only expected folders exist.
Expand Down Expand Up @@ -146,11 +146,11 @@ def verify_makefile_commands(root, config):
else:
raise ValueError(f"Environment manager '{config['environment_manager']}' not found in test harnesses.")

result = run(["bash", str(harness_path), str(root.resolve())], stderr=PIPE, stdout=PIPE)
result = run(["bash", str(harness_path), str(root.resolve())], stderr=PIPE, stdout=PIPE, encoding="utf-8")

# normally hidden by pytest except in failure we want this displayed
print("\n======================= STDOUT ======================")
print(result.stdout.decode())
print(result.stdout.decode(encoding="utf-8"))
print("\n======================= STDERR ======================")
print(result.stderr.decode())
print(result.stderr.decode(encoding="utf-8"))
assert result.returncode == 0
11 changes: 10 additions & 1 deletion tests/virtualenv_harness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,17 @@ export WORKON_HOME=$TEMP_ENV_ROOT
if [[ $(which virtualenvwrapper.sh) ]]; then
VIRTUALENVWRAPPER_SCRIPT=$(which virtualenvwrapper.sh)
else
VIRTUALENVWRAPPER_SCRIPT=$(find ${PATH//:/ } -name "virtualenvwrapper.sh" -maxdepth 1)
for path in ${PATH//:/ }; do
if [ -d "$path" ]; then
echo "Searching $path for virtualenvwrapper.sh"
FIND_RESULT=$(find $path -maxdepth 1 -name "virtualenvwrapper.sh")
if [[ "$FIND_RESULT" ]]; then
VIRTUALENVWRAPPER_SCRIPT=$FIND_RESULT
fi
fi
done
fi
echo VIRTUALENVWRAPPER_SCRIPT=$VIRTUALENVWRAPPER_SCRIPT
source $VIRTUALENVWRAPPER_SCRIPT

make create_environment
Expand Down

0 comments on commit 8796b06

Please sign in to comment.