fox-it / dissect.archive

A Dissect module implementing parsers for various archive and backup formats.
GNU Affero General Public License v3.0
0 stars 1 forks source link

Test process failing #7

Open D3vil0p3r opened 2 days ago

D3vil0p3r commented 2 days ago

I'm trying to build dissect.archive by:

git -C "dissect.archive" clean -dfx
tox -e build
tox

During the building I get

ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any
reading manifest file 'dissect.archive.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
warning: no previously-included files matching '*' found under directory '.github'

and during the tests, I get:

lint: install_deps> python -I -m pip install black==23.1.0 flake8 flake8-black flake8-isort isort==5.11.4 vermin
lint: commands[0]> flake8 dissect tests
lint: commands[1]> vermin -t=3.9- --no-tips --lint dissect tests
Detecting python files..
Analyzing 6 files using 4 processes..
Minimum required versions: 3.8
Incompatible versions:     2
lint: OK ✔ in 4.33 seconds
py3: install_deps> python -I -m pip install coverage pytest pytest-cov
.pkg: install_requires> python -I -m pip install 'setuptools>=65.5.0' 'setuptools_scm[toml]>=6.4.0'
.pkg: _optional_hooks> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: get_requires_for_build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
.pkg: build_sdist> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
py3: install_package_deps> python -I -m pip install 'dissect.cstruct<5,>=4' 'dissect.cstruct<5.0.dev,>=4.0.dev' 'dissect.util<4,>=3' 'dissect.util<4.0.dev,>=3.0.dev'
py3: install_package> python -I -m pip install --force-reinstall --no-deps /home/athena/Documenti/ba/dissect.archive/dissect.archive/.tox/.tmp/package/1/dissect_archive-1.2.tar.gz
py3: commands[0]> pytest --basetemp=/home/athena/Documenti/ba/dissect.archive/dissect.archive/.tox/py3/tmp --color=yes --cov=dissect --cov-report=term-missing -v tests
===================================================================== test session starts ======================================================================
platform linux -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0 -- /home/athena/Documenti/ba/dissect.archive/dissect.archive/.tox/py3/bin/python
cachedir: .tox/py3/.pytest_cache
rootdir: /home/athena/Documenti/ba/dissect.archive/dissect.archive
configfile: pyproject.toml
plugins: cov-5.0.0
collected 1 item                                                                                                                                               

tests/test_wim.py::test_wim /home/athena/Documenti/ba/dissect.archive/dissect.archive/.tox/py3/lib/python3.12/site-packages/coverage/control.py:894: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")
FAILED                                                                                                                       [100%]

=========================================================================== FAILURES ===========================================================================
___________________________________________________________________________ test_wim ___________________________________________________________________________

basic_wim = <gzip _io.BufferedReader name='/home/athena/Documenti/ba/dissect.archive/dissect.archive/tests/data/basic.wim.gz' 0x7ec85a29c9d0>

    def test_wim(basic_wim: BinaryIO) -> None:
>       wim = WIM(basic_wim)

tests/test_wim.py:8: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.tox/py3/lib/python3.12/site-packages/dissect/archive/wim.py:40: in __init__
    self.header = c_wim.WIMHEADER_V1_PACKED(fh)
.tox/py3/lib/python3.12/site-packages/dissect/cstruct/types/structure.py:73: in __call__
    return super().__call__(*args, **kwargs)
.tox/py3/lib/python3.12/site-packages/dissect/cstruct/types/base.py:40: in __call__
    return cls._read(stream)
<compiled _WIMHEADER_V1_PACKED._read>:6: in _read
    ???
/usr/lib/python3.12/gzip.py:324: in read
    return self._buffer.read(size)
/usr/lib/python3.12/_compression.py:68: in readinto
    data = self.read(len(byte_view))
/usr/lib/python3.12/gzip.py:527: in read
    if not self._read_gzip_header():
/usr/lib/python3.12/gzip.py:496: in _read_gzip_header
    last_mtime = _read_gzip_header(self._fp)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fp = <gzip._PaddedFile object at 0x7ec8596daba0>

    def _read_gzip_header(fp):
        '''Read a gzip header from `fp` and progress to the end of the header.

        Returns last mtime if header was present or None otherwise.
        '''
        magic = fp.read(2)
        if magic == b'':
            return None

        if magic != b'\037\213':
>           raise BadGzipFile('Not a gzipped file (%r)' % magic)
E           gzip.BadGzipFile: Not a gzipped file (b've')

/usr/lib/python3.12/gzip.py:456: BadGzipFile

---------- coverage: platform linux, python 3.12.6-final-0 -----------
Name                            Stmts   Miss  Cover   Missing
-------------------------------------------------------------
dissect/archive/__init__.py         0      0   100%
dissect/archive/c_wim.py           11     11     0%   1-245
dissect/archive/exceptions.py      10     10     0%   1-18
dissect/archive/wim.py            290    290     0%   1-498
-------------------------------------------------------------
TOTAL                             311    311     0%

=================================================================== short test summary info ====================================================================
FAILED tests/test_wim.py::test_wim - gzip.BadGzipFile: Not a gzipped file (b've')
====================================================================== 1 failed in 0.41s =======================================================================
py3: exit 1 (0.78 seconds) /home/athena/Documenti/ba/dissect.archive/dissect.archive> pytest --basetemp=/home/athena/Documenti/ba/dissect.archive/dissect.archive/.tox/py3/tmp --color=yes --cov=dissect --cov-report=term-missing -v tests pid=191906
py3: FAIL ✖ in 13.12 seconds
pypy3: skipped because could not find python interpreter with spec(s): pypy3
.pkg: _exit> python /usr/lib/python3.12/site-packages/pyproject_api/_backend.py True setuptools.build_meta
  lint: OK (4.33=setup[3.49]+cmd[0.63,0.21] seconds)
  py3: FAIL code 1 (13.11=setup[12.33]+cmd[0.78] seconds)
  pypy3: SKIP (0.16 seconds)
  evaluation failed :( (17.70 seconds)
Schamper commented 2 days ago

We use git LFS to store our unit test files, do you have git-lfs installed?

The gzip error ((b've')) probably reveals that it's trying to read the "git LFS meta file", which starts with version.

D3vil0p3r commented 2 days ago

Just tried now by installing git-lfs but I get the same error.

Schamper commented 2 days ago

Did you reclone or pull to download the LFS artifacts?

D3vil0p3r commented 2 days ago

Now yes. It seems to build correctly. I still get the building message:

ERROR setuptools_scm._file_finders.git listing git files failed - pretending there aren't any
reading manifest file 'dissect.archive.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching '.gitignore'
warning: no previously-included files matching '*' found under directory '.github'

and during the test I get this non-blocking message:

/tmp/makepkg/python-dissect.archive/src/dissect.archive/.tox/py3/lib/python3.12/site-packages/coverage/control.py:894: CoverageWarning: No data was collected. (no-data-collected)
  self._warn("No data was collected.", slug="no-data-collected")

Should be this managed?