def check(dirname): frontend = FakeFrontend() patterns = archiver._parse_ignore_file(os.path.join(dirname, ".projectignore"), frontend) assert [] == frontend.errors pattern_strings = [pattern.pattern for pattern in patterns] assert pattern_strings == []
def check(dirname): frontend = FakeFrontend() patterns = archiver._parse_ignore_file(os.path.join(dirname, ".projectignore"), frontend) assert [] == frontend.errors pattern_strings = [pattern.pattern for pattern in patterns] assert pattern_strings == ['bar', '/baz', 'whitespace_surrounding', 'foo # this comment will be part of the pattern', '#patternwithhash', 'hello']
def check(dirname): errors = [] patterns = archiver._parse_ignore_file( os.path.join(dirname, ".projectignore"), errors) assert [] == errors pattern_strings = [pattern.pattern for pattern in patterns] assert pattern_strings == []
def check(dirname): project_ops._add_projectignore_if_none(dirname) ignorefile = os.path.join(dirname, ".projectignore") assert os.path.isfile(ignorefile) frontend = FakeFrontend() patterns = archiver._parse_ignore_file(ignorefile, frontend) assert [] == frontend.errors pattern_strings = [pattern.pattern for pattern in patterns] assert pattern_strings == ['/anaconda-project-local.yml', '__pycache__/', '*.pyc', '*.pyo', '*.pyd', '/.ipynb_checkpoints', '/.spyderproject']
def check(dirname): frontend = FakeFrontend() ignorefile = os.path.join(dirname, ".projectignore") from codecs import open as real_open def mock_codecs_open(*args, **kwargs): if args[0].endswith(".projectignore"): raise IOError("NOPE") else: return real_open(*args, **kwargs) monkeypatch.setattr('codecs.open', mock_codecs_open) patterns = archiver._parse_ignore_file(ignorefile, frontend) assert patterns is None assert ["Failed to read %s: NOPE" % ignorefile] == frontend.errors # enable cleaning it up os.chmod(ignorefile, 0o777)