-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: pass envs dir path to shell script
- Loading branch information
Showing
5 changed files
with
53 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,43 @@ | ||
import pytest | ||
|
||
|
||
def test_shellsrc(script_runner): | ||
def test_script_itself(script_runner): | ||
exit_status = script_runner('') | ||
|
||
assert exit_status == 0 | ||
assert script_runner.output == '' | ||
|
||
|
||
def test_envs_dir(script_runner, envs_dir): | ||
exit_status = script_runner('echo $__luamb_envs_dir') | ||
|
||
assert exit_status == 0 | ||
assert script_runner.output == envs_dir | ||
|
||
|
||
@pytest.mark.parametrize('env_name', [ | ||
'...', | ||
'foo', | ||
'foo bar', | ||
]) | ||
def test_check_env_name_valid(script_runner, env_name): | ||
exit_status = script_runner(f"__luamb_check_env_name '{env_name}'") | ||
|
||
assert exit_status == 0 | ||
assert script_runner.output == '' | ||
|
||
|
||
@pytest.mark.parametrize('env_name,is_valid', [ | ||
('', False), | ||
('.', False), | ||
('..', False), | ||
('foo/bar', False), | ||
('/foo', False), | ||
('foo/', False), | ||
('/', False), | ||
('...', True), | ||
('foo', True), | ||
('foo bar', True), | ||
@pytest.mark.parametrize('env_name', [ | ||
'', | ||
'.', | ||
'..', | ||
'foo/bar', | ||
'/foo', | ||
'foo/', | ||
'/', | ||
]) | ||
def test_check_env_name(script_runner, env_name, is_valid): | ||
exit_status = script_runner("__luamb_check_env_name '{}'".format(env_name)) | ||
output = script_runner.output | ||
if is_valid: | ||
assert exit_status == 0 | ||
assert output == '' | ||
else: | ||
assert exit_status != 0 | ||
assert output == "invalid env name: '{}'".format(env_name) | ||
def test_check_env_name_invalid(script_runner, env_name): | ||
exit_status = script_runner(f"__luamb_check_env_name '{env_name}'") | ||
|
||
assert exit_status != 0 | ||
assert script_runner.output == f"invalid env name: '{env_name}'" |