Comments (6)
Its important to note that adding setup code to the constructor is always completely wrong for testcase subclasses
So your code was always incorrect
It simply didn't trigger before by accident
from pytest.
I just would like to confirm if this is an expected change of pytest 8.2.0 as it somehow seems to be a breaking change. If so, I guess it is worthing mentioning it in the change log https://docs.pytest.org/en/8.2.x/changelog.html. π
Yes it was an expected change though I didn't anticipate the issues and didn't consider it to be a breaking change (otherwise I wouldn't have done it in a minor release). I will definitely amend the release notes, I just haven't got to it yet.
from pytest.
As unittest itself collects instances,
Having setup code in the ctor is rightfully unexpected
from pytest.
Is there a reason you are doing these things in __init__
rather than in setUp
or similar?
from pytest.
Thanks for the response.
It is true that we can move our logic from __init__
into setUp
, and this is exactly what I am experimenting in Azure/azure-cli#28849. However, the code has been there for years and changing it will need some effort.
I just would like to confirm if this is an expected change of pytest 8.2.0 as it somehow seems to be a breaking change. If so, I guess it is worthing mentioning it in the change log https://docs.pytest.org/en/8.2.x/changelog.html. π
from pytest.
Thanks a lot @RonnyPfannschmidt for the suggestion. I will make sure to move the logic into setUp
.
from pytest.
Related Issues (20)
- Plugins loaded via `PYTEST_PLUGINS` or `pytest_plugins` are not reported HOT 3
- A problem with the pytest library not having the hookimpl attribute. HOT 3
- Flag to run tests based on the summary output of a previous run HOT 6
- No tengo plicsionea de raΓz todo es vi web y denderizado HOT 1
- Consider entry points for `PYTEST_PLUGINS` and `pytest_plugins`
- only ignore build/dist directory if next to a project config file HOT 1
- Ignore
- Latest setuptools setuptools==71.0.1 broke pytest HOT 3
- stabilizing fixture APIs (maybe specifically TopRequest)
- `_pytest/assertion/rewrite.py` do not import setuptools vendored module, but use package installed in envrionment HOT 3
- Plugins loaded via `pytest_plugins` global variable are not reported HOT 2
- Arbitrary nested test functions HOT 1
- Three tests fails with `PYTEST_PLUGINS` set to `_hypothesis_pytestplugin`
- Docs: redirect loop HOT 4
- pytest.mark.xfail from inside the test is ignored HOT 2
- Regression in pytest 8.3.1: AttributeError: 'property' object has no attribute '__code__' on Python 3.11 when combining doctest with property decoration HOT 4
- `pytest==8.3.1` collects tests from Python dependencies within `conda` environments (regression from `8.2.2`) HOT 16
- Extend pytest capabilities to support fastapi Depends-style fixtures HOT 1
- Docs: collection hooks listed under reporting hooks HOT 4
- pytest >=8.1.1 displays no diff for AssertionError with --import-mode=importlib HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest.