コード例 #1
0
def test_shell_path():
    with patch("subprocess.call") as m:
        shell = Shell("echo {path.stem} for {year}")
        shell.run(path=Path("/") / "this" / "isafile.txt",
                  year=2017,
                  simulate=False)
        m.assert_called_with("echo isafile for 2017", shell=True)
コード例 #2
0
def test_shell_path():
    with patch('subprocess.call') as m:
        shell = Shell('echo {path.stem} for {year}')
        shell.run({
            'path': Path('/') / 'this' / 'isafile.txt',
            'year': 2017
        }, False)
        m.assert_called_with('echo isafile for 2017', shell=True)
コード例 #3
0
def test_shell_path():
    with patch("subprocess.call") as m:
        shell = Shell("echo {path.stem} for {year}")
        shell.run({
            "path": Path("/") / "this" / "isafile.txt",
            "year": 2017
        }, False)
        m.assert_called_with("echo isafile for 2017", shell=True)
コード例 #4
0
def test_shell_basic():
    with patch('subprocess.call') as m:
        shell = Shell("echo 'Hello World'")
        shell.run(Path('~'), Path('~'), {}, False)
        m.assert_called_with("echo 'Hello World'", shell=True)
コード例 #5
0
def test_shell_attrs():
    with patch('subprocess.call') as m:
        shell = Shell('echo {year}')
        shell.run(Path('~'), Path('~'), {'year': 2017}, False)
        m.assert_called_with('echo 2017', shell=True)
コード例 #6
0
def test_shell_basic():
    with patch("subprocess.call") as m:
        shell = Shell("echo 'Hello World'")
        shell.run(path=Path.home(), simulate=False)
        m.assert_called_with("echo 'Hello World'", shell=True)
コード例 #7
0
def test_shell_args():
    with patch("subprocess.call") as m:
        shell = Shell("echo {year}")
        shell.run(path=Path.home(), year=2017, simulate=False)
        m.assert_called_with("echo 2017", shell=True)
コード例 #8
0
def test_shell_attrs():
    with patch("subprocess.call") as m:
        shell = Shell("echo {year}")
        shell.run({"path": Path.home(), "year": 2017}, False)
        m.assert_called_with("echo 2017", shell=True)