<s> import os <EOL> import qisys . script <EOL> import qisrc . git <EOL> from qisys . test . conftest import TestWorkTree <EOL> import pytest <EOL> def test_simple ( qisrc_action ) : <EOL> qisrc_action ( "<STR_LIT>" , "<STR_LIT:foo>" ) <EOL> qisys . script . run_action ( "<STR_LIT>" , [ "<STR_LIT:foo>" ] ) <EOL> def test_with_git ( qisrc_action ) : <EOL> qisrc_action ( "<STR_LIT>" , "<STR_LIT:foo>" , "<STR_LIT>" ) <EOL> worktree = TestWorkTree ( ) <EOL> foo_proj = worktree . get_project ( "<STR_LIT:foo>" ) <EOL> git = qisrc . git . Git ( foo_proj . path ) <EOL> ret , out = git . call ( "<STR_LIT>" , "<STR_LIT>" , raises = False ) <EOL> assert ret == <NUM_LIT:0> <EOL> assert "<STR_LIT>" in out <EOL> def test_in_subdir ( qisrc_action ) : <EOL> qisrc_action . tmpdir . mkdir ( "<STR_LIT:bar>" ) <EOL> qisrc_action . chdir ( "<STR_LIT:bar>" ) <EOL> foo_proj = qisrc_action ( "<STR_LIT>" , "<STR_LIT:foo>" ) <EOL> assert foo_proj . src == "<STR_LIT>" <EOL> def test_slashes_in_argument ( qisrc_action ) : <EOL> qisrc_action . tmpdir . mkdir ( "<STR_LIT:bar>" ) <EOL> qisrc_action ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> qisys . script . run_action ( "<STR_LIT>" , [ "<STR_LIT>" ] ) <EOL> def test_template_path ( qisrc_action , tmpdir ) : <EOL> tmpl = tmpdir . mkdir ( "<STR_LIT>" ) <EOL> tmpl . join ( "<STR_LIT>" ) . write ( "<STR_LIT>" ) <EOL> qisrc_action ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , tmpl . strpath ) <EOL> qisrc_action . reload_worktree ( ) <EOL> worktree = qisrc_action . git_worktree . worktree <EOL> helloworld_proj = worktree . get_project ( "<STR_LIT>" ) <EOL> with open ( os . path . join ( helloworld_proj . path , "<STR_LIT>" ) ) as fp : <EOL> assert fp . read ( ) == "<STR_LIT>" <EOL> def test_no_worktree ( tmpdir ) : <EOL> tmpl = tmpdir . mkdir ( "<STR_LIT>" ) <EOL> tmpl . join ( "<STR_LIT>" ) . write ( "<STR_LIT>" ) <EOL> dest = tmpdir . mkdir ( "<STR_LIT>" ) <EOL> with qisys . sh . change_cwd ( dest . strpath ) : <EOL> qisys . script . run_action ( "<STR_LIT>" , <EOL> [ "<STR_LIT>" , tmpl . strpath , "<STR_LIT>" ] ) <EOL> assert dest . join ( "<STR_LIT>" , "<STR_LIT>" ) . check ( file = True ) <EOL> def test_create_inside_template ( qisrc_action , tmpdir ) : <EOL> tmpl = tmpdir . mkdir ( "<STR_LIT>" ) <EOL> tmpl . join ( "<STR_LIT>" ) . write ( "<STR_LIT>" ) <EOL> inside = tmpl . mkdir ( "<STR_LIT>" ) <EOL> with qisys . sh . change_cwd ( inside . strpath ) : <EOL> with pytest . raises ( qisys . error . Error ) as e : <EOL> qisys . script . run_action ( "<STR_LIT>" , <EOL> [ "<STR_LIT>" , tmpl . strpath , "<STR_LIT>" ] ) <EOL> assert e . value . message == "<STR_LIT>" </s>
