Giter Site home page Giter Site logo

Comments (5)

benjyw avatar benjyw commented on June 20, 2024

pytest itself depends on packaging, so I suspect that is the issue. Are you installing pytest from a custom resolve?

If so, you can set the packaging version in that resolve's lockfile inputs.

One convenient way to do this is to add pytest to your python_rasa resolve (it may already be there because your tests probably import from it?) and then set:

[pytest]
install_from_resolve = "python_rasa"  
# Enumerate the requirements that pytest actually needs to run itself.
# If you don't it will use the entire lockfile, which means every lockfile change will invalidate all tests.
requirements =[...]  

from pants.

enriquemaffezzini avatar enriquemaffezzini commented on June 20, 2024

You nailed it! Using install_from_resolve = "python_rasa" in the toml file does the trick.

Can you think of any way in which I can force this project tests to use the project's resolve pytest or to override the pytest resolve for such tests? I need to keep the rest of the projects with the same pytest setting. Specifying the resolve in the test folder build file like this is not having the expected effect:

projects/chatbot/tests/BUILD

python_tests(
    name="tests",
    resolve="python_rasa"
)

from pants.

benjyw avatar benjyw commented on June 20, 2024

Unfortunately that is not currently possible - the resolve that pytest runs from is set globally. However this is a much-requested feature in the New Python Backend discussions. Feel free to chime in there.

For now, probably best is to generate a custom pytest lockfile that pins packaging.

This is an unfortunate problem with pytest - it loads the code under test into the same namespace as its own code. Really, it should "shade" itself and its dependencies.

from pants.

enriquemaffezzini avatar enriquemaffezzini commented on June 20, 2024

Thanks a lot for your guidance was very valuable. We got everything working following your advice

from pants.

benjyw avatar benjyw commented on June 20, 2024

Glad to hear it! Hopefully in the future this will be handled more smoothly.

from pants.

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.