Giter VIP home page Giter VIP logo

Comments (6)

RonnyPfannschmidt avatar RonnyPfannschmidt commented on September 23, 2024 1

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.

bluetech avatar bluetech commented on September 23, 2024 1

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.

RonnyPfannschmidt avatar RonnyPfannschmidt commented on September 23, 2024 1

As unittest itself collects instances,
Having setup code in the ctor is rightfully unexpected

from pytest.

bluetech avatar bluetech commented on September 23, 2024

Is there a reason you are doing these things in __init__ rather than in setUp or similar?

from pytest.

jiasli avatar jiasli commented on September 23, 2024

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.

jiasli avatar jiasli commented on September 23, 2024

Thanks a lot @RonnyPfannschmidt for the suggestion. I will make sure to move the logic into setUp.

from pytest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.