Exemplo n.º 1
0
def test_actions_of(tmpdir, example):

    actions = list(actions_of(example))

    interesting = [a_c_t(x) for x in actions]
    expected = [('write', 'test_simplefactory.py'),
                ('shell', 'py.test test_simplefactory.py')]

    assert interesting == expected
Exemplo n.º 2
0
def test_actions_of(tmpdir, example):

    actions = list(actions_of(example))

    interesting = [a_c_t(x) for x in actions]
    expected = [
        ('write', 'test_simplefactory.py'),
        ('shell', 'py.test test_simplefactory.py')]

    assert interesting == expected
Exemplo n.º 3
0
def test_docfile_chdir(tmpdir):

    tmpdir.ensure('nested/file').write('some text\n')
    example = tmpdir.join('example.txt')
    example.write('some shell test\n'
                  '  nested $ cat file\n'
                  '  some other text\n')

    action, = list(actions_of(example))
    excpected_action = {
        'action': 'shell',
        'file': example,
        'content': 'some other text\n',
        'cwd': 'nested',
        'indent': 2,
        'line': 1,
        'target': 'cat file',
    }
    assert action == excpected_action

    needed_updates = check_file(example, tmpdir)
    pprint.pprint(needed_updates)
    assert needed_updates
Exemplo n.º 4
0
def test_docfile_chdir(tmpdir):

    tmpdir.ensure('nested/file').write('some text\n')
    example = tmpdir.join('example.txt')
    example.write('some shell test\n'
                  '  nested $ cat file\n'
                  '  some other text\n')

    action, = list(actions_of(example))
    excpected_action = {
        'action': 'shell',
        'file': example,
        'content': 'some other text\n',
        'cwd': 'nested',
        'indent': 2,
        'line': 1,
        'target': 'cat file',
    }
    assert action == excpected_action

    needed_updates = check_file(example, tmpdir)
    py.std.pprint.pprint(needed_updates)
    assert needed_updates