

def test_compile_file(monkeypatch, tmpdir):
    monkeypatch.setattr('static_precompiler.settings.ROOT', tmpdir.strpath)
    convert_urls = pretend.call_recorder((lambda *args: None))
    monkeypatch.setattr('static_precompiler.utils.convert_urls', convert_urls)
    compiler = compilers.Stylus()
    assert (compiler.compile_file('styles/stylus/A.styl') == 'COMPILED/styles/stylus/A.css')
    full_output_path = compiler.get_full_output_path('styles/stylus/A.styl')
    assert (convert_urls.calls == [pretend.call(full_output_path, 'styles/stylus/A.styl')])
    assert os.path.exists(full_output_path)
    with open(full_output_path) as compiled:
        assert (compiled.read() == 'p {\n  color: #f00;\n}\n')

dataset/ETHPy150Open andreyfedoseev/django-static-precompiler/static_precompiler/tests/test_stylus.py test_compile_file/original