-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.22.0: pytest fails in two units #283
Comments
May I ask where/for what OS? It's already being packaged by our team for Fedora/EPEL: https://src.fedoraproject.org/rpms/python-specfile You can fix the first failure by running pytest only on As for the second failure, I can't really tell without reproducing it. |
So if those directories only should be scanned it means that that pytest |
Ok, I can add that. |
Remove deepdiff lock and set default testpaths The deepdiff bug has been fixed: seperman/deepdiff@410019e Testing dependencies only satisfy unit and integration tests, make them the default. Partially fixes #283. Reviewed-by: Matej Focko
@kloczek Could you provide more info so I can try to reproduce the second failure? |
I think that I've provided all those details (because I've been using my template of the ticket with some pytest fails) 😋 As input source I'm using source tree unpacked from tar ball generated from git tag. BTW I'll try to test ASP already merged PR (will back with result shortly). |
Just tested #284 and indeed one unit is OK now + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-specfile-0.22.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-specfile-0.22.0-2.fc35.x86_64/
usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.18, pytest-7.4.1, pluggy-1.3.0
rootdir: /home/tkloczko/rpmbuild/BUILD/specfile-0.22.0
configfile: setup.cfg
testpaths: tests/unit, tests/integration
collected 271 items
tests/unit/test_changelog.py .................................... [ 13%]
tests/unit/test_conditions.py .... [ 14%]
tests/unit/test_formatter.py ........... [ 18%]
tests/unit/test_guess_packager.py ......... [ 22%]
tests/unit/test_macro_definitions.py ..... [ 23%]
tests/unit/test_macros.py ....F [ 25%]
tests/unit/test_options.py ..................... [ 33%]
tests/unit/test_prep.py ................ [ 39%]
tests/unit/test_sections.py ............ [ 43%]
tests/unit/test_sourcelist.py ... [ 45%]
tests/unit/test_sources.py ............................................. [ 61%]
.. [ 62%]
tests/unit/test_spec_parser.py .... [ 63%]
tests/unit/test_specfile.py .......... [ 67%]
tests/unit/test_tags.py .... [ 69%]
tests/unit/test_utils.py ............................ [ 79%]
tests/unit/test_value_parser.py ................. [ 85%]
tests/integration/test_specfile.py ..................................... [ 99%]
.. [100%]
=================================== FAILURES ===================================
______________________________ test_macros_reinit ______________________________
def test_macros_reinit():
Macros.reinit(MacroLevel.BUILTIN)
> assert all(m.level == MacroLevel.BUILTIN for m in Macros.dump())
E assert False
E + where False = all(<generator object test_macros_reinit.<locals>.<genexpr> at 0x7f6d97271580>)
tests/unit/test_macros.py:112: AssertionError
=========================== short test summary info ============================
FAILED tests/unit/test_macros.py::test_macros_reinit - assert False
======================== 1 failed, 270 passed in 3.97s ========================= |
Particularly RPM installation details. But I'm curious, did the test pass before (with versions older than 0.22.0)? Could you run this code and post the output? from specfile.macros import Macros, MacroLevel
Macros.reinit(MacroLevel.BUILTIN)
print([m for m in Macros.dump() if m.level != MacroLevel.BUILTIN]) |
Here is my spec file # BUG: test suite is failing https://github.com/packit/specfile/issues/283
%bcond_with failing_tests # By default skip some failing test units
Summary: A library for parsing and manipulating RPM spec files
Name: python-specfile
Version: 0.22.0
Release: 2%{?dist}
License: MIT (https://spdx.org/licenses/MIT.html)
URL: https://pypi.org/project/specfile/
VCS: https://github.com/packit/specfile/
Source: %{VCS}/archive/%{version}/%{name}-%{version}.tar.gz
Patch: %{VCS}/pull/284.patch#/%{name}-Remove-deepdiff-lock-and-set-default-testpaths.patch
BuildArch: noarch
BuildRequires: python3dist(build)
BuildRequires: python3dist(installer)
BuildRequires: python3dist(setuptools-scm)
BuildRequires: python3dist(setuptools-scm-git-archive)
BuildRequires: python3dist(wheel)
# ChcekRequires:
BuildRequires: git-core
BuildRequires: python3dist(flexmock)
BuildRequires: python3dist(pytest)
Obsoletes: python3-specfile
%description
Python library for parsing and manipulating RPM spec files. Main focus is on
modifying existing spec files, any change should result in a minimal diff.
%prep
%autosetup -p1 -n specfile-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%check
%pytest %{!?with_failing_tests: \
--deselect tests/unit/test_macros.py::test_macros_reinit \
}
%files
%doc README.*
%{python3_sitelib}/specfile
%{python3_sitelib}/specfile-*.*-info However without some some macros which I'm usimg above probably will not allow use you straight. [tkloczko@pers-jacek SPECS]$ rpm -E %pytest
\
ASMFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
CFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
CXXFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none";
FFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules";
FCFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -I/usr/lib64/gfortran/modules";
LDFLAGS="-Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1";
RUSTFLAGS="-C codegen-units=1 -C debuginfo=2 -C opt-level=2 -C link-arg=-fdata-sections -C link-arg=-ffunction-sections -C link-arg=-Wl,--as-needed -C link-arg=-Wl,-z,now -C link-arg=-Wl,-z,relro --cap-lints=warn" ;
VALAFLAGS="-g" ;
CC="/usr/bin/gcc"; CXX="/usr/bin/g++"; FC="/usr/bin/gfortran";
AR="/usr/bin/gcc-ar"; NM="/usr/bin/gcc-nm"; RANLIB="/usr/bin/gcc-ranlib";
export ASMFLAGS CFLAGS CXXFLAGS FFLAGS FCFLAGS LDFLAGS VALAFLAGS CC CXX FC AR NM RANLIB RUSTFLAGS VALAFLAGS;
\
PATH=/home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/bin:$PATH \
LD_LIBRARY_PATH=/home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib64 \
PYTHONDONTWRITEBYTECODE=1 \
PDM_BUILD_SCM_VERSION=%{version} \
PBR_VERSION=%{version} \
SETUPTOOLS_SCM_PRETEND_VERSION=%{version} \
PYTHONPATH=${PYTHONPATH:-/home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/%{NAME}-%{VERSION}-%{RELEASE}.x86_64/usr/lib/python3.8/site-packages} \
\
/usr/bin/pytest -ra -m "not network" Nevertheless it should be possible to reproduce this fail without rpm.
I had those two units in --deselect list in last few months and sorry I had no time to report that. |
Just FTR: tested 0.28.0 and looks like pytest fails like before. |
Tested 0.28.1 and still fails. |
Sorry, I can't do anything about this without being able to reproduce it or at least having a dump of macros from the affected system.
|
What happened? What is the problem?
Looks like pytest fails in two units.
What did you expect to happen?
pytest should not fail.
Example URL(s)
N/A
Steps to reproduce
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulescut off from access to the public network
(pytest is executed with-m "not network"
)Here is pytest output:
Here is list of installed modules in build env
Workaround
Participation
The text was updated successfully, but these errors were encountered: