def test_skips_directories(tmpdir): src = tmpdir.join('src').ensure_dir() dest = tmpdir.join('dest').ensure_dir() src.join('__pycache__').ensure_dir() format_files(src, dest) assert not dest.join('__pycache__').exists()
def test_format_files_skips_pyc(tmpdir): src = tmpdir.join('src').ensure_dir() dest = tmpdir.join('dest').ensure_dir() src.join('setup.py').write('# Setup.py') src.join('setup.pyc').write("# Setup.pyc, don't copy me!") format_files(src, dest) assert dest.join('setup.py').exists() assert not dest.join('setup.pyc').exists()
def test_format_files(tmpdir): src = tmpdir.join('src').ensure_dir() dest = tmpdir.join('dest').ensure_dir() src.join('file1.txt').write('{foo} bar {baz}') src.join('file2.txt').write('hello world') src.join('file3.txt').write('foo bar {baz}') format_files(src, dest, foo='herp', baz='derp') assert dest.join('file1.txt').read() == 'herp bar derp' assert dest.join('file2.txt').read() == 'hello world' assert dest.join('file3.txt').read() == 'foo bar derp'