def test_explicitFiles():
    """
        If one of the paths given to iter_source_code is not a directory but
        a file, it will include that in its output
    """
    epath = make_empty_file('e.py')
    assert list(iter_source_code([epath])) == [epath]
def test_recurses():
    """If the Python files are hidden deep down in child directories, we will find them."""
    os.mkdir(os.path.join(TEMP_DIR, 'foo'))
    apath = make_empty_file('foo', 'a.py')
    os.mkdir(os.path.join(TEMP_DIR, 'bar'))
    bpath = make_empty_file('bar', 'b.py')
    cpath = make_empty_file('c.py')
    assert sorted(iter_source_code([TEMP_DIR])) == sorted([apath, bpath, cpath])
Beispiel #3
0
def test_recurses():
    """If the Python files are hidden deep down in child directories, we will find them."""
    os.mkdir(os.path.join(TEMP_DIR, 'foo'))
    apath = make_empty_file('foo', 'a.py')
    os.mkdir(os.path.join(TEMP_DIR, 'bar'))
    bpath = make_empty_file('bar', 'b.py')
    cpath = make_empty_file('c.py')
    assert sorted(iter_source_code([TEMP_DIR
                                    ])) == sorted([apath, bpath, cpath])
def test_multipleDirectories():
    """iter_source_code can be given multiple directories - it will recurse into each of them"""
    foopath = os.path.join(TEMP_DIR, 'foo')
    barpath = os.path.join(TEMP_DIR, 'bar')
    os.mkdir(foopath)
    apath = make_empty_file('foo', 'a.py')
    os.mkdir(barpath)
    bpath = make_empty_file('bar', 'b.py')
    assert sorted(iter_source_code([foopath, barpath])) == sorted([apath, bpath])
Beispiel #5
0
def test_multipleDirectories():
    """iter_source_code can be given multiple directories - it will recurse into each of them"""
    foopath = os.path.join(TEMP_DIR, 'foo')
    barpath = os.path.join(TEMP_DIR, 'bar')
    os.mkdir(foopath)
    apath = make_empty_file('foo', 'a.py')
    os.mkdir(barpath)
    bpath = make_empty_file('bar', 'b.py')
    assert sorted(iter_source_code([foopath,
                                    barpath])) == sorted([apath, bpath])
Beispiel #6
0
    def run(self):
        reporter = ProspectorReporter(ignore=self.ignore_codes)

        for filepath in iter_source_code(self._paths):
            if any([ip.search(filepath) for ip in self._ignores]):
                continue

            check_path(filepath, reporter)

        return reporter.get_messages()
Beispiel #7
0
    def run(self):
        reporter = ProspectorReporter(ignore=self.ignore_codes)

        for filepath in iter_source_code(self._paths):
            if any([ip.search(filepath) for ip in self._ignores]):
                continue

            check_path(filepath, reporter)

        return reporter.get_messages()
Beispiel #8
0
def test_explicitFiles():
    """If one of the paths given to iter_source_code is not a directory but a
    file, it will include that in its output."""
    epath = make_empty_file('e.py')
    assert list(iter_source_code([epath])) == [epath]
Beispiel #9
0
def test_onlyPythonSource():
    """Files that are not Python source files are not included."""
    make_empty_file('foo.pyc')
    assert list(iter_source_code([TEMP_DIR])) == []
Beispiel #10
0
def test_singleFile():
    """If the directory contains one Python file - iter_source_code will find it"""
    childpath = make_empty_file('foo.py')
    assert list(iter_source_code([TEMP_DIR])) == [childpath]
Beispiel #11
0
def test_emptyDirectory():
    """There are no Python files in an empty directory."""
    assert list(iter_source_code([TEMP_DIR])) == []
def test_onlyPythonSource():
    """Files that are not Python source files are not included."""
    make_empty_file('foo.pyc')
    assert list(iter_source_code([TEMP_DIR])) == []
def test_singleFile():
    """If the directory contains one Python file - iter_source_code will find it"""
    childpath = make_empty_file('foo.py')
    assert list(iter_source_code([TEMP_DIR])) == [childpath]
def test_emptyDirectory():
    """There are no Python files in an empty directory."""
    assert list(iter_source_code([TEMP_DIR])) == []