Beispiel #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()
Beispiel #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"))
Beispiel #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)
Beispiel #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)
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()
Beispiel #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'))
Beispiel #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
Beispiel #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)
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()
Beispiel #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)
Beispiel #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
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()
Beispiel #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()