

def test_locate_imported_file(monkeypatch):
    compiler = compilers.Stylus()
    root = os.path.dirname(__file__)
    existing_files = set()
    for f in ('A/B.styl', 'C.styl'):
        existing_files.add(os.path.join(compiler, 'static', utils.normalize_path(f)))
    monkeypatch.setattr('os.path.exists', (lambda x: (x in existing_files)))
    assert (compiler.locate_imported_file('A', 'B.styl') == 'A/B.styl')
    assert (compiler.locate_imported_file('', 'C.styl') == 'C.styl')
    with pytest.raises(exceptions.StaticCompilationError):
        compiler.locate_imported_file('', 'Z.styl')

dataset/ETHPy150Open andreyfedoseev/django-static-precompiler/static_precompiler/tests/test_stylus.py test_locate_imported_file/VarMisuse@56/84 `root`->`compiler`