Ejemplo n.º 1
0
def test_test_makefile():
    setup()
    n.assert_raises(AssertionError, check_sprint.test_has_makefile)
    open('Makefile', 'w').write('')
    n.assert_raises(AssertionError, check_sprint.test_has_makefile)
    open('Makefile', 'w').write('.PHONY: test\ntest:\n  urchin test')
    check_sprint.test_has_makefile()
Ejemplo n.º 2
0
def test_directories():
    "The appropriate directories should be created."
    setup()
    init.directories()
    for directory in ["code", "lib", "test"]:
        yield n.assert_true, os.path.isdir(directory)
        yield n.assert_true, os.path.isfile(os.path.join(directory, ".gitignore"))
Ejemplo n.º 3
0
def test_existing_file_is_ok():
    'If some skeleton files already exist, init should quietly skip them.'
    banana = 'I am a banana.'
    setup()
    open('readme.md', 'w').write(banana)
    init.readme()
    n.assert_equal(open('readme.md').read(), banana)
Ejemplo n.º 4
0
def test_existing_file_is_ok():
    "If some skeleton files already exist, init should quietly skip them."
    banana = "I am a banana."
    setup()
    open("readme.md", "w").write(banana)
    init.readme()
    n.assert_equal(open("readme.md").read(), banana)
Ejemplo n.º 5
0
def test_test_makefile():
    setup()
    n.assert_raises(AssertionError, check_sprint.test_has_makefile)
    open('Makefile', 'w').write('')
    n.assert_raises(AssertionError, check_sprint.test_has_makefile)
    open('Makefile', 'w').write('.PHONY: test\ntest:\n  urchin test')
    check_sprint.test_has_makefile()
Ejemplo n.º 6
0
def test_directories():
    'The appropriate directories should be created.'
    setup()
    init.directories()
    for directory in ['code', 'lib', 'test']:
        yield n.assert_true, os.path.isdir(directory)
        yield n.assert_true, os.path.isfile(
            os.path.join(directory, '.gitignore'))
Ejemplo n.º 7
0
def test_readme():
    "A readme should be created with the appropriate sections."
    setup()
    init.readme()
    yield n.assert_true, os.path.isfile("readme.md")
    readme = open("readme.md").read()
    for section in ["Overview", "References", "Goals", "Assignment", "Extra Credit", "Glossary"]:
        yield n.assert_in, "\n## %s" % section, readme
Ejemplo n.º 8
0
def test_add_gitignore():
    setup()
    init.gitignore()
    gitignore = open('.gitignore').read()
    n.assert_in('*.pyc', gitignore)
    n.assert_in('.urchin.log', gitignore)

    open('.gitignore', 'w').write('chainsaw')
    init.gitignore()
    gitignore = open('.gitignore').read()
    n.assert_equal('chainsaw', gitignore)
Ejemplo n.º 9
0
def test_test_shell_files_correspond():
    setup()
    check_sprint.test_shell_files_correspond()

    os.mkdir('code')
    os.mkdir('test')
    open(os.path.join('code', 'foo.sh'), 'w').write('')
    n.assert_raises(AssertionError, check_sprint.test_shell_files_correspond)

    open(os.path.join('test', 'foo.sh'), 'w').write('')
    check_sprint.test_shell_files_correspond()
Ejemplo n.º 10
0
def test_add_gitignore():
    setup()
    init.gitignore()
    gitignore = open(".gitignore").read()
    n.assert_in("*.pyc", gitignore)
    n.assert_in(".urchin.log", gitignore)

    open(".gitignore", "w").write("chainsaw")
    init.gitignore()
    gitignore = open(".gitignore").read()
    n.assert_equal("chainsaw", gitignore)
Ejemplo n.º 11
0
def test_readme():
    'A readme should be created with the appropriate sections.'
    setup()
    init.readme()
    yield n.assert_true, os.path.isfile('readme.md')
    readme = open('readme.md').read()
    for section in [
            'Overview', 'References', 'Goals', 'Assignment', 'Extra Credit',
            'Glossary'
    ]:
        yield n.assert_in, '\n## %s' % section, readme
Ejemplo n.º 12
0
def test_test_shell_files_correspond():
    setup()
    check_sprint.test_shell_files_correspond()

    os.mkdir('code')
    os.mkdir('test')
    open(os.path.join('code', 'foo.sh'), 'w').write('')
    n.assert_raises(AssertionError, check_sprint.test_shell_files_correspond)

    open(os.path.join('test', 'foo.sh'), 'w').write('')
    check_sprint.test_shell_files_correspond()
Ejemplo n.º 13
0
def test_test_python_init():
    setup()
    os.mkdir('code')
    os.mkdir('test')
    check_sprint.test_python_init()

    open(os.path.join('code', 'foo.py'), 'w').write('foo')
    n.assert_raises(AssertionError, check_sprint.test_python_init)
    os.remove(os.path.join('code', 'foo.py'))

    open(os.path.join('code', '__init__.py'), 'w').write('foo')
    check_sprint.test_python_init()
Ejemplo n.º 14
0
def test_test_python_init():
    setup()
    os.mkdir('code')
    os.mkdir('test')
    check_sprint.test_python_init()

    open(os.path.join('code', 'foo.py'), 'w').write('foo')
    n.assert_raises(AssertionError, check_sprint.test_python_init)
    os.remove(os.path.join('code', 'foo.py'))

    open(os.path.join('code', '__init__.py'), 'w').write('foo')
    check_sprint.test_python_init()
Ejemplo n.º 15
0
def test_test_python_files_correspond():
    setup()
    check_sprint.test_python_files_correspond()

    os.mkdir('code')
    os.mkdir('test')
    open(os.path.join('code', 'foo.py'), 'w').write('')
    open(os.path.join('code', '__init__.py'), 'w').write('')
    n.assert_raises(AssertionError, check_sprint.test_python_files_correspond)

    open(os.path.join('test', 'test_foo.py'), 'w').write('')
    check_sprint.test_python_files_correspond()
Ejemplo n.º 16
0
def test_test_python_files_correspond():
    setup()
    check_sprint.test_python_files_correspond()

    os.mkdir('code')
    os.mkdir('test')
    open(os.path.join('code', 'foo.py'), 'w').write('')
    open(os.path.join('code', '__init__.py'), 'w').write('')
    n.assert_raises(AssertionError, check_sprint.test_python_files_correspond)

    open(os.path.join('test', 'test_foo.py'), 'w').write('')
    check_sprint.test_python_files_correspond()
Ejemplo n.º 17
0
def test_existing_dir_is_ok():
    'If some skeleton files already exist, init should quietly skip them.'
    setup()
    os.mkdir('code')
    init.directories()
Ejemplo n.º 18
0
def test_test_has_a_test():
    setup()
    n.assert_raises(AssertionError, check_sprint.test_has_a_test)
    os.mkdir('test')
    open(os.path.join('test', 'foo'), 'w').write('')
    check_sprint.test_has_a_test()
Ejemplo n.º 19
0
def test_existing_dir_is_ok():
    "If some skeleton files already exist, init should quietly skip them."
    setup()
    os.mkdir("code")
    init.directories()
Ejemplo n.º 20
0
def test_test_has_a_test():
    setup()
    n.assert_raises(AssertionError, check_sprint.test_has_a_test)
    os.mkdir('test')
    open(os.path.join('test', 'foo'), 'w').write('')
    check_sprint.test_has_a_test()