ideafast/middleware-services

Fix installing_with_constraints in .nox file

Opened this issue · 3 comments

Possibly a local issue, but @davidverweij cannot run nox commands fully as desired due to issues with python, poetry and nox combined. @jawrainey was unable to replicate these issues - so for now we circumvented the install_with_constraints in noxfile.py by introducing:

def tests(session: Session) -> None:
    """Setup for automated testing with pytest"""
    from cli import run_command

    run_command("pytest")

Ideally, this uses the install_with_constraints() wrapper to ensure replicate-ability across machines. I.e.:

def tests(session: Session) -> None:
    """Setup for automated testing with pytest"""
    args = session.posargs
    session.run("poetry", "install", "--no-dev", external=True)
    install_with_constraints(session, "pytest")
    session.run("pytest", *args)

In my personal case, nox removes all dev dependencies from the poetry shell instance to run its tests (and fails due to missing dependencies - as well as not having access to modules). Instead, it should install without dev dependencies in its own virtual env.

Related to this is the use of --without-hashes which is needed for my machine, but again not being able to replicate elsewhere.

@davidverweij -- wasn't this resolved in #37 and so can be closed?

Unfortunately no, especially the pytest / tests setup. I'll try to investigate again soon.