allofplos icon indicating copy to clipboard operation
allofplos copied to clipboard

test error in Debian fresh install

Open sbassi opened this issue 7 years ago • 0 comments

The package was installed with pip install allofplos (not by cloning the repo)

Also installed the test part with:

pip install -U allofplos[test]

root@7881ab553829:~# python -c "from allofplos import get_corpus_dir; print(get_corpus_dir())" /usr/local/lib/python3.6/site-packages/allofplos/allofplos_xml

When I try to run the tests I get:

root@7881ab553829:~# pytest --pyargs allofplos
========================================================= test session starts =========================================================
platform linux -- Python 3.6.5, pytest-3.5.0, py-1.5.3, pluggy-0.6.0
rootdir: /root, inifile:
collected 20 items                                                                                                                    

allofplos/tests/test_corpus.py .FFLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2002354.xml
FLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2002354.xml
FLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2002354.xml
FLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2002354.xml
FFFFFF                                                                                     [ 60%]
allofplos/tests/test_unittests.py ...Local article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pone.0185809.xml
FLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2001413.xml
FLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/plos.correction.3155a3e9-5fbe-435c-a07a-e9a4846ec0b6.xml
FLocal article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2002399.xml
F.                                                                                      [100%]

============================================================== FAILURES ===============================================================
___________________________________________________________ test_corpus_len ___________________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f60581bd9e8>

    def test_corpus_len(corpus):
>       assert len(corpus) == 5

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:26: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:33: in __len__
    return len(self.dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f60581bd9e8>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
__________________________________________________________ test_corpus_iter_ __________________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efbe208>

    def test_corpus_iter_(corpus):
>       article_dois = {article.doi for article in corpus}

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:36: in __iter__
    return (article for article in self.random_article_generator)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:132: in random_article_generator
    for doi in self.iter_random_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:152: in iter_random_dois
    return (doi for doi in self.random.sample(self.dois, len(self)))
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efbe208>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
____________________________________________________ test_corpus_contains_article _____________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efb2668>
no_article = DOI: 10.1371/journal.pmed.0030132
Title: Bigger and Better: How Pfizer Redefined Erectile Dysfunction
yes_article = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604efb2b38>

    def test_corpus_contains_article(corpus, no_article, yes_article):
>       assert yes_article in corpus

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:39: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:62: in __contains__
    is_in = value.doi in self.dois and value.directory == self.directory
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efb2668>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
______________________________________________________ test_corpus_contains_doi _______________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efaf208>
no_article = DOI: 10.1371/journal.pmed.0030132
Title: Bigger and Better: How Pfizer Redefined Erectile Dysfunction
yes_article = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604efaf2e8>

    def test_corpus_contains_doi(corpus, no_article, yes_article):
>       assert yes_article.doi in corpus

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:43: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:64: in __contains__
    doi_in = value in self.dois
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efaf208>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
____________________________________________________ test_corpus_contains_filepath ____________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efcc0f0>
no_article = DOI: 10.1371/journal.pmed.0030132
Title: Bigger and Better: How Pfizer Redefined Erectile Dysfunction
yes_article = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604efcc1d0>

    def test_corpus_contains_filepath(corpus, no_article, yes_article):
        ## check for filepath, which is currently called filename on Article
>       assert yes_article.filename in corpus

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:64: in __contains__
    doi_in = value in self.dois
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efcc0f0>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
______________________________________________________ test_corpus_contains_file ______________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efe04a8>
no_article = DOI: 10.1371/journal.pmed.0030132
Title: Bigger and Better: How Pfizer Redefined Erectile Dysfunction
yes_article = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604efe0ba8>

    def test_corpus_contains_file(corpus, no_article, yes_article):
        ## check for filename, which is currently unavailable on Article
>       assert os.path.basename(yes_article.filename) in corpus

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:64: in __contains__
    doi_in = value in self.dois
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efe04a8>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
_____________________________________________________ test_corpus_random_article ______________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efd8f28>

    def test_corpus_random_article(corpus):
>       article = corpus.random_article

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:57: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:136: in random_article
    return next(self.random_article_generator)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:132: in random_article_generator
    for doi in self.iter_random_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:152: in iter_random_dois
    return (doi for doi in self.random.sample(self.dois, len(self)))
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efd8f28>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
________________________________________________________ test_corpus_indexing _________________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efe0400>

    def test_corpus_indexing(corpus):
>       assert corpus["10.1371/journal.pbio.2001413"] == corpus[0]

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:61: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:45: in __getitem__
    elif key not in self.dois:
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:115: in dois
    return list(self.iter_dois)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:98: in iter_dois
    return (x[1] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efe0400>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
_________________________________________________________ test_iter_file_doi __________________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efabf28>

    def test_iter_file_doi(corpus):
        expected = {
         'journal.pbio.2001413.xml': '10.1371/journal.pbio.2001413',
         'journal.pbio.2002354.xml': '10.1371/journal.pbio.2002354',
         'journal.pbio.2002399.xml': '10.1371/journal.pbio.2002399',
         'journal.pone.0185809.xml': '10.1371/journal.pone.0185809',
         'plos.correction.3155a3e9-5fbe-435c-a07a-e9a4846ec0b6.xml':
             '10.1371/annotation/3155a3e9-5fbe-435c-a07a-e9a4846ec0b6',
         }
>       assert expected == {f:doi for f, doi in corpus.iter_file_doi}

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:74: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efabf28>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
___________________________________________________________ test_filepaths ____________________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efd8240>

    def test_filepaths(corpus):
>       assert set(corpus.filepaths) == set(listdir_nohidden(TESTDATADIR))

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:78: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:120: in filepaths
    return list(self.iter_filepaths)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:103: in iter_filepaths
    return (os.path.join(self.directory, fname) for fname in self.iter_files)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:89: in iter_files
    return (x[0] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efd8240>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
_____________________________________________________________ test_files ______________________________________________________________

corpus = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efd0a20>

    def test_files(corpus):
        annote_file = 'plos.correction.3155a3e9-5fbe-435c-a07a-e9a4846ec0b6.xml'
>       assert annote_file in corpus.files

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_corpus.py:82: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:109: in files
    return list(self.iter_files)
/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:89: in iter_files
    return (x[0] for x in self.iter_file_doi)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[FileNotFoundError("[Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'") raised in repr()] Corpus object at 0x7f604efd0a20>

    @property
    def iter_file_doi(self):
        """Generator that returns filename, doi tuples for every file in the corpus.
    
            Used to generate both DOI and file generators for the corpus.
            """
        return ((file_, filename_to_doi(file_))
>               for file_ in sorted(os.listdir(self.directory))
                if file_.endswith(self.extension) and 'DS_Store' not in file_)
E       FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/allofplos/tests/testdata'

/usr/local/lib/python3.6/site-packages/allofplos/corpus/corpus.py:77: FileNotFoundError
__________________________________________________ TestArticleClass.test_class_doi1 ___________________________________________________

self = <allofplos.tests.test_unittests.TestArticleClass testMethod=test_class_doi1>

    def test_class_doi1(self):
        """Tests the methods and properties of the Article class
            Test article DOI: 10.1371/journal.pone.0185809
            TODO: there is a socket warning from requests module. See https://github.com/requests/requests/issues/3912
            XML file is in test directory
            """
        article = Article(class_doi, directory=TESTDATADIR)
        # self.assertEqual(article.check_if_doi_resolves(), "works", 'check_if_doi_resolves does not transform correctly for {}'.format(article.doi))
        # self.assertEqual(article.check_if_link_works(), True, 'check_if_link_works does not transform correctly for {}'.format(article.doi))
>       self.assertEqual(article.amendment, False, 'amendment does not transform correctly for {}'.format(article.doi))

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_unittests.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:1180: in amendment
    if self.type_ in ['correction', 'retraction', 'expression-of-concern']:
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:1095: in type_
    "article"])
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:201: in get_element_xpath
    root = self.root
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604efe8438>

    @property
    def root(self):
        """Get the root (base) element of an article.
            """
>       return self.tree.getroot()
E       AttributeError: 'NoneType' object has no attribute 'getroot'

/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:807: AttributeError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
Local article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pone.0185809.xml
__________________________________________________ TestArticleClass.test_example_doi __________________________________________________

self = <allofplos.tests.test_unittests.TestArticleClass testMethod=test_example_doi>

    def test_example_doi(self):
        """Tests the methods and properties of the Article class
            Test article DOI: 10.1371/journal.pbio.2001413
            XML file is in test directory
            """
        article = Article(example_doi, directory=TESTDATADIR)
        # self.assertEqual(article.check_if_doi_resolves(), "works", 'check_if_doi_resolves does not transform correctly for {}'.format(article.doi))
        # self.assertEqual(article.check_if_link_works(), True, 'check_if_link_works does not transform correctly for {}'.format(article.doi))
>       self.assertEqual(article.amendment, False, 'amendment does not transform correctly for {}'.format(article.doi))

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_unittests.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:1180: in amendment
    if self.type_ in ['correction', 'retraction', 'expression-of-concern']:
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:1095: in type_
    "article"])
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:201: in get_element_xpath
    root = self.root
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604eee9208>

    @property
    def root(self):
        """Get the root (base) element of an article.
            """
>       return self.tree.getroot()
E       AttributeError: 'NoneType' object has no attribute 'getroot'

/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:807: AttributeError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
Local article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2001413.xml
_________________________________________________ TestArticleClass.test_example_doi2 __________________________________________________

self = <allofplos.tests.test_unittests.TestArticleClass testMethod=test_example_doi2>

    def test_example_doi2(self):
        """Tests the methods and properties of the Article class
            Test article DOI: 10.1371/annotation/3155a3e9-5fbe-435c-a07a-e9a4846ec0b6
            XML file is in test directory
            """
        article = Article(example_doi2, directory=TESTDATADIR)
        # self.assertEqual(article.check_if_doi_resolves(), "works", 'check_if_doi_resolves does not transform correctly for {}'.format(article.doi))
        # self.assertEqual(article.check_if_link_works(), True, 'check_if_link_works does not transform correctly for {}'.format(article.doi))
>       self.assertEqual(article.amendment, True, 'amendment does not transform correctly for {}'.format(article.doi))

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_unittests.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:1180: in amendment
    if self.type_ in ['correction', 'retraction', 'expression-of-concern']:
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:1095: in type_
    "article"])
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:201: in get_element_xpath
    root = self.root
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604eeeb908>

    @property
    def root(self):
        """Get the root (base) element of an article.
            """
>       return self.tree.getroot()
E       AttributeError: 'NoneType' object has no attribute 'getroot'

/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:807: AttributeError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
Local article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/plos.correction.3155a3e9-5fbe-435c-a07a-e9a4846ec0b6.xml
____________________________________________________ TestArticleClass.test_proofs _____________________________________________________

self = <allofplos.tests.test_unittests.TestArticleClass testMethod=test_proofs>

    def test_proofs(self):
        """Tests whether uncorrected proofs and VOR updates are being detected correctly."""
        os.environ['PLOS_CORPUS'] = TESTDATADIR
        article = Article(example_uncorrected_doi)
>       self.assertTrue(article.proof == 'uncorrected_proof')

/usr/local/lib/python3.6/site-packages/allofplos/tests/test_unittests.py:193: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:897: in proof
    xpath_results = self.get_element_xpath()
/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:201: in get_element_xpath
    root = self.root
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NoneType' object has no attribute 'getroot'") raised in repr()] Article object at 0x7f604ebc84a8>

    @property
    def root(self):
        """Get the root (base) element of an article.
            """
>       return self.tree.getroot()
E       AttributeError: 'NoneType' object has no attribute 'getroot'

/usr/local/lib/python3.6/site-packages/allofplos/article_class.py:807: AttributeError
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
Local article file not found: /usr/local/lib/python3.6/site-packages/allofplos/tests/testdata/journal.pbio.2002399.xml
================================================ 15 failed, 5 passed in 26.18 seconds =================================================
root@7881ab553829:~# 

The problem is that the testdata directory is not installed. Maybe it is because there is no __init__.py file inside?

sbassi avatar Apr 03 '18 02:04 sbassi