def test_compile_files_not_right_extension(tmpdir): with io.open(os.path.join(tmpdir.strpath, 'foo.tmpl'), 'w') as foo_tmpl: foo_tmpl.write('Hello world') assert not _compile_files_in_directory( tmpdir.strpath, ('foo.tmpl',), extension='.txt', ) assert not os.path.exists(os.path.join(tmpdir.strpath, 'foo.py'))
def test_compile_files_not_right_extension(tmpdir): with io.open(os.path.join(tmpdir.strpath, 'foo.tmpl'), 'w') as foo_tmpl: foo_tmpl.write('Hello world') assert not _compile_files_in_directory( tmpdir.strpath, ('foo.tmpl',), extension='.txt', ) assert not os.path.exists(os.path.join(tmpdir.strpath, 'foo.py'))
def test_compile_file_with_other_extension(tmpdir): with io.open(os.path.join(tmpdir.strpath, 'foo.txt'), 'w') as foo_tmpl: foo_tmpl.write('Hello world') with io.open(os.path.join(tmpdir.strpath, 'bar.tmpl'), 'w') as bar_tmpl: bar_tmpl.write('Hi world') assert _compile_files_in_directory( tmpdir.strpath, ('foo.txt', 'bar.tmpl'), extension='.txt', ) assert os.path.exists(os.path.join(tmpdir.strpath, 'foo.py')) assert not os.path.exists(os.path.join(tmpdir.strpath, 'bar.py'))
def test_compile_file_with_other_extension(tmpdir): with io.open(os.path.join(tmpdir.strpath, 'foo.txt'), 'w') as foo_tmpl: foo_tmpl.write('Hello world') with io.open(os.path.join(tmpdir.strpath, 'bar.tmpl'), 'w') as bar_tmpl: bar_tmpl.write('Hi world') assert _compile_files_in_directory( tmpdir.strpath, ('foo.txt', 'bar.tmpl'), extension='.txt', ) assert os.path.exists(os.path.join(tmpdir.strpath, 'foo.py')) assert not os.path.exists(os.path.join(tmpdir.strpath, 'bar.py'))
def test_compile_files_in_directory_some_files(tmpdir): with io.open(os.path.join(tmpdir.strpath, 'foo.tmpl'), 'w') as foo_tmpl: foo_tmpl.write('Hello world') assert _compile_files_in_directory(tmpdir.strpath, ('foo.tmpl',)) assert os.path.exists(os.path.join(tmpdir.strpath, 'foo.py'))
def test_compile_files_in_directory_no_files(tmpdir): assert not _compile_files_in_directory(tmpdir.strpath, ())
def test_compile_files_in_directory_some_files(tmpdir): with io.open(os.path.join(tmpdir.strpath, 'foo.tmpl'), 'w') as foo_tmpl: foo_tmpl.write('Hello world') assert _compile_files_in_directory(tmpdir.strpath, ('foo.tmpl',)) assert os.path.exists(os.path.join(tmpdir.strpath, 'foo.py'))
def test_compile_files_in_directory_no_files(tmpdir): assert not _compile_files_in_directory(tmpdir.strpath, ())