Skip to content

remove python setup.py test #4789

Closed
Closed

Description

@zzzeek

apparently the use of this command is deprecated, see

pypa/setuptools#1684

pytest-dev/pytest#5546

Would like guidance from @graingert on best practice here.

Activity

  1. added
    bug
    setup
    on Jul 31, 2019
  2. added this to the 1.4 milestone on Jul 31, 2019
  3. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    so for SQLAlchemy we can target this at 1.4, for everybody else, we likely have to push them all to a new Y release also as distributions use this in their testing. however, right now python setup.py test has broken under Python 2 in any case as setuptools does not respect the python_requires marker (see https://twitter.com/codewithanthony/status/1156576971607797760) so these all install the incompatible pytest 5. so, this is kind of a breakage storm raining down.

  4. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    What we want to have happen is that users can run:

    "tox"

    and that will run basic tests. so the tox.ini will have to be reconfigued so that the more elaborate series of environments are not run by default, but not sure if this is possible.

  5. asottile commented on Jul 31, 2019

    @asottile

    for the tox parts, this setting is helpful: https://github.com/tox-dev/tox/blob/94436c320aa06a323cfc6bc5e2c2277a0586f2ab/tox.ini#L15

    anything not in envlist won't get run by default but you can still call those individual environments with tox -e ... or TOXENV=... tox

  6. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    @asottile at the moment, I am trying this:

    [tox]
    envlist = py
    
    [testenv]
    ....
    

    when I type "tox" it seems to just install a single python environment using the default interpreter.

    However, then I can't run my more complex environments like:

    tox -e py37-mysql-cext

    so it seems like "envlist" has two purposes, to define the structure of tokenized environments, and to specify what runs when you type "tox", and I need these to be broken out somehow

  7. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    I don't even know how it works, the envlist and the "deps" seem to both inform the "generative envlist" feature since I don't have the database tokens in my setenv.

  8. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    it looks like any factor that's included in a config anywhere is fair game, so none of them need to be inside of envlist. sqlalchemy has been relying on this for years, but I'm not sure tox documents this.

  9. asottile commented on Jul 31, 2019

    @asottile

    ah I see what it is, cext is a factor that's only in the envlist -- the absense of nocext is the same as specifying cext

    here's the docs on factors but you're right I don't think there's as much depth as there should be there: https://tox.readthedocs.io/en/latest/config.html#factors-and-factor-conditional-settings

  10. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    Like if I do this, this does what I want. but am I breaking the rules?

    diff --git a/tox.ini b/tox.ini
    index ea520f9fe0..dc8c0ecea7 100644
    --- a/tox.ini
    +++ b/tox.ini
    @@ -1,6 +1,6 @@
     
     [tox]
    -envlist = py{27,34,35,36,37}-{cext,nocext}
    +envlist = py
     
     [testenv]
     # note that we have a .coveragerc file that points coverage specifically
    @@ -13,7 +13,22 @@ cov_args=--cov=sqlalchemy --cov-report term --cov-append --cov-report xml --excl
     install_command=python -m pip install {env:TOX_PIP_OPTS:} {opts} {packages}
     
     usedevelop=
    -     cov: True
    +    cov: True
    +
    +# list of factors we use, note that tox automatically considers to be a
    +# valid "factor" any factor token in any config setting
    +sqlalchemy_factors=
    +	cext: ''
    +	nocext: ''
    +	cov: ''
    +	postgresql: ''
    +	mysql: ''
    +	oracle: ''
    +	oracle6: ''
    +	oracle5: ''
    +	mssql: ''
    +	backendonly: ''
    +
     
     deps=pytest!=3.9.1,!=3.9.2
          pytest-xdist
    
  11. asottile commented on Jul 31, 2019

    @asottile

    I think if you just treat tox -e py37 as the cext factor you don't need the rest of those -- as long as a factor is used in one of the settings it will be available as an env name

    so I think you can keep the tox.ini the same (or delete the envlist line since it defaults to py) and adjust references to the -cext envs by dropping the cext factor

    pretty sure tox even allows tox -e py37-oracle-oracle6-cov-nocext even though it's nonsense 🤷‍♂️

  12. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    "cext" is indeed an implicit factor however I need a symbol there because I'm integrating with Jenkins matrix builds and the matrix keywords go straight into the tox environment name.

  13. asottile commented on Jul 31, 2019

    @asottile

    I would maybe do something like this?

    diff --git a/tox.ini b/tox.ini
    index ea520f9..8680962 100644
    --- a/tox.ini
    +++ b/tox.ini
    @@ -1,6 +1,4 @@
    -
     [tox]
    -envlist = py{27,34,35,36,37}-{cext,nocext}
     
     [testenv]
     # note that we have a .coveragerc file that points coverage specifically
    @@ -76,6 +74,7 @@ passenv=ORACLE_HOME NLS_LANG TOX_POSTGRESQL TOX_MYSQL TOX_ORACLE TOX_MSSQL TOX_S
     
     # for nocext, we rm *.so in lib in case we are doing usedevelop=True
     commands=
    +  cext: sh -c "echo testing c extensions"
       nocext: sh -c "rm -f lib/sqlalchemy/*.so"
       {env:BASECOMMAND} {env:WORKERS} {env:SQLITE:} {env:POSTGRESQL:} {env:MYSQL:} {env:ORACLE:} {env:MSSQL:} {env:BACKENDONLY:} {env:IDENTS:} {env:NOMEMORY:} {env:COVERAGE:} {posargs}
       oracle,oracle6,oracle5,mssql: python reap_dbs.py db_idents.txt
  14. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    ah good idea

  15. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    I think I need the default "py" in envlist, otherwise it goes off and builds pep8 and such.

  16. zzzeek commented on Jul 31, 2019

    @zzzeek
    MemberAuthor

    eh or I just name the first env [testenv:py]

  17. asottile commented on Jul 31, 2019

    @asottile

    oh right, I didn't notice that you have other testenvs defined -- envlist = py probably makes sense

  18. sqla-tester commented on Oct 23, 2019

    @sqla-tester
    Collaborator

    Mike Bayer has proposed a fix for this issue in the master branch:

    Remove python setup.py test; fix SQL Server URL https://gerrit.sqlalchemy.org/1535

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughigh prioritysetup

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions