[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help: Test suite failures (Was: ITP: anndata -- Annotated gene by sample numpy matrix)



It sure looks like at least some of those failures are from upstreams
tests assuming they'd be run directly in the source tree.

All but one of the test cases can be fixed by including some test files
in the package, though it ends up in anndata/tests/

It's about 9 kilobytes with a csv, tsv, and xlsx file included.

This is probably the easiest solution, though I though I remember
Debian policy discouraging putting data into the dist-packages
directory.

I'm not sure about the last test failure though

--- setup.py	2020-03-02 16:10:44.668936082 -0800
+++ /run/schroot/mount/unstable-amd64-sbuild-6f63c09f-36e0-4302-9409-
6689c5b05354/build/python-anndata-exfcES/python-anndata-
0.7.4+ds/setup.py	2020-11-05 13:51:59.763629317 -0800
@@ -28,4 +28,5 @@
     packages=find_namespace_packages(include=["anndata",
"anndata.*"]),
     include_package_data=True,
+    package_data={"": ["*.csv", "*.tsv", "*.xlsx"]},
     zip_safe=False,
     classifiers=[

On Thu, 2020-11-05 at 21:08 +0100, Andreas Tille wrote:
> Control: tags -1 help
> 
> Hi Diane and Steffen,
> 
> I fixed the Build-Depends in this package which leads to the
> effect that
> 
>   a) the Build-time test is run
>   b) shows the same errors as the autopkgtest
> 
> 
> ...
> anndata/tests/test_deprecations.py::test_get_uns_neighbors_deprecated
> FAILED [ 36%]
> ...
> anndata/tests/test_readwrite.py::test_read_csv
> FAILED                    [ 51%]
> anndata/tests/test_readwrite.py::test_read_tsv_strpath
> FAILED            [ 51%]
> anndata/tests/test_readwrite.py::test_read_tsv_iter
> FAILED               [ 51%]
> ...
> anndata/tests/test_readwrite.py::test_read_excel
> FAILED                  [ 51%]
> ...
> =================================== FAILURES
> ===================================
> ______________________ test_get_uns_neighbors_deprecated
> _______________________
> 
> adata = AnnData object with n_obs × n_vars = 2 × 3
>     obs: 'anno1'
>     var: 'anno2'
>     uns: 'neighbors'
>     layers: 'x2'
>     obsp: 'connectivities'
> 
>     def test_get_uns_neighbors_deprecated(adata):
>         n = adata.shape[0]
>         mtx = sparse.random(n, n, density=0.3, format="csr")
>         adata.obsp["connectivities"] = mtx
>         adata.uns["neighbors"] = {}
> ....
>         with pytest.warns(FutureWarning):
>             from_uns = adata.uns["neighbors"]["connectivities"]
> ....
>         assert_equal(from_uns, mtx)
> ....
>         with pytest.warns(None) as rec:
>             v = adata[: n // 2]
> >           assert not rec
> E           assert not WarningsChecker(record=True)
> 
> anndata/tests/test_deprecations.py:113: AssertionError
> ________________________________ test_read_csv
> _________________________________
> 
>     def test_read_csv():
> >       adata = ad.read_csv(HERE / "adata.csv")
> 
> anndata/tests/test_readwrite.py:308:.
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> anndata/_io/read.py:48: in read_csv
>     return read_text(filename, delimiter, first_column_names, dtype)
> anndata/_io/read.py:321: in read_text
>     with filename.open() as f:
> /usr/lib/python3.9/pathlib.py:1241: in open
>     return io.open(self, mode, buffering, encoding, errors, newline,
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> 
> self = PosixPath('/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata.csv'
> )
> name = '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata.csv'
> flags = 524288, mode = 438
> 
>     def _opener(self, name, flags, mode=0o666):
>         # A stub for the opener argument to built-in open()
> >       return self._accessor.open(self, flags, mode)
> E       FileNotFoundError: [Errno 2] No such file or directory:
> '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata.csv'
> 
> /usr/lib/python3.9/pathlib.py:1109: FileNotFoundError
> ____________________________ test_read_tsv_strpath
> _____________________________
> 
>     def test_read_tsv_strpath():
> >       adata = ad.read_text(str(HERE / "adata-comments.tsv"), "\t")
> 
> anndata/tests/test_readwrite.py:315:.
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> anndata/_io/read.py:321: in read_text
>     with filename.open() as f:
> /usr/lib/python3.9/pathlib.py:1241: in open
>     return io.open(self, mode, buffering, encoding, errors, newline,
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> 
> self = PosixPath('/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata-
> comments.tsv')
> name = '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata-
> comments.tsv'
> flags = 524288, mode = 438
> 
>     def _opener(self, name, flags, mode=0o666):
>         # A stub for the opener argument to built-in open()
> >       return self._accessor.open(self, flags, mode)
> E       FileNotFoundError: [Errno 2] No such file or directory:
> '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata-
> comments.tsv'
> 
> /usr/lib/python3.9/pathlib.py:1109: FileNotFoundError
> ______________________________ test_read_tsv_iter
> ______________________________
> 
>     def test_read_tsv_iter():
> >       with (HERE / "adata-comments.tsv").open() as f:
> 
> anndata/tests/test_readwrite.py:322:.
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> /usr/lib/python3.9/pathlib.py:1241: in open
>     return io.open(self, mode, buffering, encoding, errors, newline,
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> 
> self = PosixPath('/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata-
> comments.tsv')
> name = '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata-
> comments.tsv'
> flags = 524288, mode = 438
> 
>     def _opener(self, name, flags, mode=0o666):
>         # A stub for the opener argument to built-in open()
> >       return self._accessor.open(self, flags, mode)
> E       FileNotFoundError: [Errno 2] No such file or directory:
> '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/adata-
> comments.tsv'
> 
> /usr/lib/python3.9/pathlib.py:1109: FileNotFoundError
> _______________________________ test_read_excel
> ________________________________
> 
>     def test_read_excel():
> >       adata = ad.read_excel(HERE / "data/excel.xlsx", "Sheet1",
> > dtype=int)
> 
> anndata/tests/test_readwrite.py:365:.
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> anndata/_io/read.py:70: in read_excel
>     df = read_excel(fspath(filename), sheet)
> /usr/lib/python3/dist-packages/pandas/util/_decorators.py:296: in
> wrapper
>     return func(*args, **kwargs)
> /usr/lib/python3/dist-packages/pandas/io/excel/_base.py:304: in
> read_excel
>     io = ExcelFile(io, engine=engine)
> /usr/lib/python3/dist-packages/pandas/io/excel/_base.py:867: in
> __init__
>     self._reader = self._engines[engine](self._io)
> /usr/lib/python3/dist-packages/pandas/io/excel/_xlrd.py:22: in
> __init__
>     super().__init__(filepath_or_buffer)
> /usr/lib/python3/dist-packages/pandas/io/excel/_base.py:353: in
> __init__
>     self.book = self.load_workbook(filepath_or_buffer)
> /usr/lib/python3/dist-packages/pandas/io/excel/_xlrd.py:37: in
> load_workbook
>     return open_workbook(filepath_or_buffer)
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _ _ _.
> 
> filename = '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/data/excel
> .xlsx'
> logfile = <_pytest.capture.EncodedFile object at 0x7ff6a4c226a0>,
> verbosity = 0
> use_mmap = 1, file_contents = None, encoding_override = None
> formatting_info = False, on_demand = False, ragged_rows = False
> 
>     def open_workbook(filename=None,
>         logfile=sys.stdout,
>         verbosity=0,
>         use_mmap=USE_MMAP,
>         file_contents=None,
>         encoding_override=None,
>         formatting_info=False,
>         on_demand=False,
>         ragged_rows=False,
>         ):
>         """
>         Open a spreadsheet file for data extraction.
>     
>         :param filename: The path to the spreadsheet file to be
> opened.
>     
>         :param logfile: An open file to which messages and
> diagnostics are written.
>     
>         :param verbosity: Increases the volume of trace material
> written to the
>                           logfile.
>     
>         :param use_mmap:
>     
>           Whether to use the mmap module is determined heuristically.
>           Use this arg to override the result.
>     
>           Current heuristic: mmap is used if it exists.
>     
>         :param file_contents:
>     
>           A string or an :class:`mmap.mmap` object or some other
> behave-alike
>           object. If ``file_contents`` is supplied, ``filename`` will
> not be used,
>           except (possibly) in messages.
>     
>         :param encoding_override:
>     
>           Used to overcome missing or bad codepage information
>           in older-version files. See :doc:`unicode`.
> ...
> E           FileNotFoundError: [Errno 2] No such file or directory:
> '/build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build/anndata/tests/data/excel
> .xlsx'
> 
> /usr/lib/python3/dist-packages/xlrd/__init__.py:116:
> FileNotFoundError
> =============================== warnings summary
> ===============================
> ...
> = 5 failed, 1442 passed, 18 skipped, 25 xfailed, 910 warnings in
> 67.22 seconds =
> E: pybuild pybuild:353: test: plugin distutils failed with: exit
> code=1: cd /build/python-anndata-
> 0.7.4+ds/.pybuild/cpython3_3.9_anndata/build; python3.9 -m pytest -v
> 
> 
> The very same errors occure for Python3.8 so it does not seem to be
> just
> a Python3.9 issue.
> 
> 
> Any hints are welcome
> 
>       Andreas.
> 
> 


Reply to: