pytest-html icon indicating copy to clipboard operation
pytest-html copied to clipboard

Fix pypy3 tests

Open BeyondEvil opened this issue 3 years ago • 10 comments

BeyondEvil avatar Jan 17 '22 13:01 BeyondEvil

No clue why pypy is failing. Opened a ticket here

BeyondEvil avatar Jan 17 '22 13:01 BeyondEvil

@BeyondEvil compount issue with tox and setuptools_scm

when tox tries to find the version, it gets warning output from setuptools_scm as well

@gaborbernat any idea what this could be ?

@BeyondEvil a workaround may be to unshallow the checkout and/or ensure its filtered instead of completely shallow

RonnyPfannschmidt avatar Jan 17 '22 14:01 RonnyPfannschmidt

FTR; as far as i can tell setuptools_scm warning output lands on the stdout instead of the stderr, this could indicate a pypy bug

RonnyPfannschmidt avatar Jan 17 '22 14:01 RonnyPfannschmidt

as far as i can tell setuptools_scm warning output lands on the stdout instead of the stderr, this could indicate a pypy bug

A small reproducer would be helpful

mattip avatar Jan 17 '22 15:01 mattip

There is an error when running tox deep inside pytest (this one is from the Ubuntu run). Why should that be on stdout?

python -m tox -e pypy3-cov
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/PyPy/3.8.12/x64/bin
.package create: /home/runner/work/pytest-html/pytest-html/.tox/.package
.package installdeps: pip >= 19.3.1, setuptools >= 42, setuptools_scm[toml] >= 3.5.0, setuptools_scm_git_archive >= 1.1, wheel >= 0.33.6
Traceback (most recent call last):
  File "/opt/hostedtoolcache/PyPy/3.8.12/x64/lib/pypy3.8/site-packages/py/_error.py", line 66, in checked_call
    return func(*args, **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: '/home/runner/work/pytest-html/pytest-html/.tox/dist/  

If I run pip install of these packages it succeeds:

pypy3.8-HEAD/bin/pypy -m pip install "pip >= 19.3.1" "setuptools >= 42" "setuptools_scm[toml] >= 3.5.0" \
"setuptools_scm_git_archive >= 1.1" "wheel >= 0.33.6"
Requirement already satisfied: pip>=19.3.1 in ./pypy3.8-HEAD/lib/pypy3.8/site-packages (21.1.1)
Requirement already satisfied: setuptools>=42 in ./pypy3.8-HEAD/lib/pypy3.8/site-packages (56.0.0)
Collecting setuptools_scm[toml]>=3.5.0
  Using cached setuptools_scm-6.3.2-py3-none-any.whl (33 kB)
Collecting setuptools_scm_git_archive>=1.1
  Using cached setuptools_scm_git_archive-1.1-py2.py3-none-any.whl (3.3 kB)
Collecting wheel>=0.33.6
  Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting packaging>=20.0
  Using cached packaging-21.3-py3-none-any.whl (40 kB)
Collecting tomli>=1.0.0
  Using cached tomli-2.0.0-py3-none-any.whl (12 kB)
Collecting pyparsing!=3.0.5,>=2.0.2
  Using cached pyparsing-3.0.6-py3-none-any.whl (97 kB)
Installing collected packages: pyparsing, tomli, packaging, setuptools-scm, wheel, setuptools-scm-git-archive
Successfully installed packaging-21.3 pyparsing-3.0.6 setuptools-scm-6.3.2 setuptools-scm-git-archive-1.1 tomli-2.0.0 wheel-0.37.1

mattip avatar Jan 17 '22 15:01 mattip

I don't know.

I'll try to create a small repro repo later.

BeyondEvil avatar Jan 17 '22 16:01 BeyondEvil

I tried to reproduce locally, following the commands in the runner log (from Ubuntu)

cd /tmp
wget https://downloads.python.org/pypy/pypy3.8-v7.3.7-linux64.tar.bz2
tar -xf pypy3.8-v7.3.7-linux64.tar.bz2
pypy3.8-v7.3.7-linux64/bin/python -m ensurepip
pypy3.8-v7.3.7-linux64/bin/python -m pip install --upgrade tox
git clone https://github.com/pytest-dev/pytest-html.git
cd pytest-html
../pypy3.8-v7.3.7-linux64/bin/python -m tox -e pypy3-cov

Tests run and pass.

mattip avatar Jan 17 '22 17:01 mattip

I tried to reproduce locally, following the commands in the runner log (from Ubuntu)

cd /tmp
wget https://downloads.python.org/pypy/pypy3.8-v7.3.7-linux64.tar.bz2
tar -xf pypy3.8-v7.3.7-linux64.tar.bz2
pypy3.8-v7.3.7-linux64/bin/python -m ensurepip
pypy3.8-v7.3.7-linux64/bin/python -m pip install --upgrade tox
git clone https://github.com/pytest-dev/pytest-html.git
cd pytest-html
../pypy3.8-v7.3.7-linux64/bin/python -m tox -e pypy3-cov

Tests run and pass.

Ok, that's good to know.

I'm working on a repro repo.

BeyondEvil avatar Jan 17 '22 17:01 BeyondEvil

I tried to reproduce locally, following the commands in the runner log (from Ubuntu)

cd /tmp
wget https://downloads.python.org/pypy/pypy3.8-v7.3.7-linux64.tar.bz2
tar -xf pypy3.8-v7.3.7-linux64.tar.bz2
pypy3.8-v7.3.7-linux64/bin/python -m ensurepip
pypy3.8-v7.3.7-linux64/bin/python -m pip install --upgrade tox
git clone https://github.com/pytest-dev/pytest-html.git
cd pytest-html
../pypy3.8-v7.3.7-linux64/bin/python -m tox -e pypy3-cov

Tests run and pass.

Maybe I'm just stupid and/or it's a total red herring, but if I remove pyproject.toml from the repro repo that I'm setting up I get an error that I can't figure out why I'm getting. As far as I can tell, there is no reference to it from a GHA or tox perspective.

https://github.com/BeyondEvil/pypy3-error-repro/runs/4844352587?check_suite_focus=true

So, maybe the issue is related to it somehow? Maybe something to do with setuptools?

Wait... could this be related:

[tool.setuptools_scm]
local_scheme = "no-local-version"
write_to = "src/pytest_html/__version.py"

I still don't get why it breaks if the file is missing completely...

I guess crisis averted, seems like today Tox relies on pyproject.toml being present.

BeyondEvil avatar Jan 17 '22 17:01 BeyondEvil

@RonnyPfannschmidt What are the potential drawbacks of switching the plugin to pyproject.toml instead?

At the very least do what we do in https://github.com/pytest-dev/pytest-selenium?

BeyondEvil avatar Jan 17 '22 21:01 BeyondEvil

Not sure how relevant this is anymore. Closing.

Feel free to reopen if I'm wrong.

BeyondEvil avatar Nov 04 '23 16:11 BeyondEvil

We have weekly CI runs of PyPy + pytest-html to make sure it keeps working. Since the tests are green, I think it is fine to close.

mattip avatar Nov 04 '23 20:11 mattip