Changeset - 72f144e1fffb
[Not reviewed]
0 3 0
Brett Smith - 4 years ago 2020-09-03 13:45:31
brettcsmith@brettcsmith.org
extract_odf_links: Make "not found" warning easier to parse.

e.g., you can just use `grep | cut -b N-`.
3 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/tools/extract_odf_links.py
Show inline comments
...
 
@@ -170,13 +170,13 @@ def main(arglist: Optional[Sequence[str]]=None,
 
            path = queue.get()
 
            if path is None:
 
                procs_left -= 1
 
            elif path not in seen:
 
                seen.add(path)
 
                if not path.exists():
 
                   logger.warning("path %s not found", path)
 
                   logger.warning("link path not found: %s", path)
 
                print(path, end=args.delimiter, file=stdout)
 

	
 
    returncode = 0
 
    for odf_path, proc in zip(args.odf_paths, procs):
 
        try:
 
            proc.result()
setup.py
Show inline comments
...
 
@@ -2,13 +2,13 @@
 

	
 
from setuptools import setup
 

	
 
setup(
 
    name='conservancy_beancount',
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.9.2',
 
    version='1.9.3',
 
    author='Software Freedom Conservancy',
 
    author_email='info@sfconservancy.org',
 
    license='GNU AGPLv3+',
 

	
 
    install_requires=[
 
        'babel>=2.6',  # Debian:python3-babel
tests/test_extract_odf_links.py
Show inline comments
...
 
@@ -23,12 +23,13 @@ from pathlib import Path
 

	
 
from . import testutil
 

	
 
from conservancy_beancount.tools import extract_odf_links
 

	
 
SRC_PATH = testutil.test_path('repository/LinksReport.ods')
 
BAD_PATH_S = str(testutil.test_path('repository/Projects/Bad Link.txt'))
 

	
 
INCLUDED_FILE_LINKS = {
 
    Path('/repository/Projects/project-data.yml'),
 
    Path('Projects/project-data.yml'),
 
    Path('Projects/Bad Link.txt'),
 
}
...
 
@@ -60,13 +61,14 @@ def test_extract_file_links(arglist, sep, caplog):
 
    assert exitcode == 0
 
    assert not stderr.getvalue()
 
    check_output(stdout, sep, SRC_PATH.parent)
 
    assert caplog.records
 
    assert any(
 
        log.levelname == 'WARNING'
 
        and log.message.endswith('/Bad Link.txt not found')
 
        and log.message.startswith('link path not found: ')
 
        and log.message.endswith(BAD_PATH_S)
 
        for log in caplog.records
 
    )
 

	
 
@pytest.mark.parametrize('rel_path', [
 
    Path('/run'),
 
    Path('/tmp'),
0 comments (0 inline, 0 general)