Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tox does not support tags out of the box #1764

Closed
themr0c opened this issue Feb 21, 2019 · 7 comments
Closed

tox does not support tags out of the box #1764

themr0c opened this issue Feb 21, 2019 · 7 comments
Labels

Comments

@themr0c
Copy link
Contributor

themr0c commented Feb 21, 2019

Issue Type

  • Bug report

Molecule and Ansible details

master branch

Detail any linters or test runners used:

Desired Behavior

Better documentation about usage of tox tags.

Actual Behaviour

In https://molecule.readthedocs.io/en/latest/testing.html, documentation is stating that you can test with tox tags

pip install tox
tox -t unit

But tox (3.7.0) does not support tags out of the box.

tox -t unit
usage: tox [--version] [-h] [--help-ini] [-v] [-q] [--showconfig] [-l] [-a] [-c CONFIGFILE] [-e envlist] [--notest] [--sdistonly] [-p VAL] [-o] [--parallel--safe-build] [--installpkg PATH]
           [--develop] [-i URL] [--pre] [-r] [--result-json PATH] [--hashseed SEED] [--force-dep REQ] [--sitepackages] [--alwayscopy] [-s [val]] [--workdir PATH]
           [args [args ...]]
tox: error: unrecognized arguments: -t

Is it a feature removed from tox or a dependency we are missing in the documentation ?

@themr0c themr0c added the docs label Feb 21, 2019
@themr0c themr0c added this to the v.2.21 milestone Feb 21, 2019
@themr0c
Copy link
Contributor Author

themr0c commented Feb 21, 2019

We have better results when installing tox-tags (which is in test-requirements.txt)

either:

pip install -r test-requirements.txt

or:

pip install tox https://github.com/AndreLouisCaron/tox-tags/archive/master.zip#egg=tox-tags

I see later in the file this line, where the usage of the tag has been replaced by a search which is probably obscure for the profane.

tox -e $(tox -l | grep lint | paste -d, -s -)

I believe the most sane solution is following:

  1. Replace
pip install pip

by

pip install -r test-requirements.txt
  1. Welcome back usage of tags in the documentation, for clarity purpose:
tox -t lint

What is your opinion ? @lwm ? @gundalow ? @webknjaz ?

@themr0c
Copy link
Contributor Author

themr0c commented Feb 21, 2019

Hum, i have not better result: tox -t unit is running only on one version of python apparently. So maybe the best option is to remove tags completely in fact ?

tox -t unit is fine

@decentral1se
Copy link
Contributor

RE: tags, we saw the idea of removing it in #1732 (comment), which I think sounds fine if we can make the setup simpler! If you want to use this issue as a diving board for that, then please do! I have a documentation PR for testing come one day TM.

@themr0c
Copy link
Contributor Author

themr0c commented Feb 21, 2019

tox -e unit and tox -t unit are doing really different things.

IMHO, to run tests on a workstation, the tagged version is more featurefull, from an end user (tester) perspective. I would not run after removing the tags feature.

tox -e unit

=> runs unit tests on one virtualenv, using same python version as the python you are running from (but it does not appear clearly)

  unit: commands succeeded
tox -t unit

=> runs unit tests on all environments tagged as unit:

  py27-ansible25-unit: commands succeeded
  py27-ansible26-unit: commands succeeded
  py27-ansible27-unit: commands succeeded
SKIPPED:  py35-ansible25-unit: InterpreterNotFound: python3.5
SKIPPED:  py35-ansible26-unit: InterpreterNotFound: python3.5
SKIPPED:  py35-ansible27-unit: InterpreterNotFound: python3.5
ERROR:   py36-ansible25-unit: Error creating virtualenv. Note that some special characters (e.g. ':' and unicode symbols) in paths are not supported by virtualenv. Error details: InvocationError('/usr/bin/python -m virtualenv --python /usr/bin/python3.6 py36-ansible25-unit (see /home/.ecryptfs/src/externals/themr0c/molecule/.tox/py36-ansible25-unit/log/py36-ansible25-unit-0.log)', 1)
ERROR:   py36-ansible26-unit: Error creating virtualenv. Note that some special characters (e.g. ':' and unicode symbols) in paths are not supported by virtualenv. Error details: InvocationError('/usr/bin/python -m virtualenv --python /usr/bin/python3.6 py36-ansible26-unit (see /home/.ecryptfs/src/externals/themr0c/molecule/.tox/py36-ansible26-unit/log/py36-ansible26-unit-0.log)', 1)
ERROR:   py36-ansible27-unit: Error creating virtualenv. Note that some special characters (e.g. ':' and unicode symbols) in paths are not supported by virtualenv. Error details: InvocationError('/usr/bin/python -m virtualenv --python /usr/bin/python3.6 py36-ansible27-unit (see /home/.ecryptfs/src/externals/themr0c/molecule/.tox/py36-ansible27-unit/log/py36-ansible27-unit-0.log)', 1)
  py37-ansible25-unit: commands succeeded
  py37-ansible26-unit: commands succeeded
  py37-ansible27-unit: commands succeeded

To achieve same behavior without tags, we would use this insane command, which is really not user friendly.

tox -e $(tox -l | grep unit | paste -d, -s -)

Maybe we should discuss that matter further in the ticket and in next irc meeting ?

@webknjaz
Copy link
Member

I didn't know that somebody uses those... OTOH I wonder if there's any other ways which would be easier maintainable.

@themr0c
Copy link
Contributor Author

themr0c commented Feb 21, 2019

@webknjaz i have the same feeling about maintainability.

I could not find in tox documentation some way to aggregate the run of different environments in one command. This tag plugin adresses precisely that: have a simple command to put in the documentation, and to use to test before pushing.

On my laptop I have some issue, though, because py35 and py36 are respectively skipped and failed :/.

@webknjaz
Copy link
Member

@themr0c maybe there's not enough copy-paste in tox.ini and some tags are missing?

@decentral1se decentral1se removed this from the v.2.21 milestone Feb 27, 2019
decentral1se added a commit to decentral1se/molecule that referenced this issue Mar 22, 2019
decentral1se added a commit to decentral1se/molecule that referenced this issue Mar 23, 2019
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
themr0c added a commit to themr0c/molecule that referenced this issue Mar 27, 2019
…ion accordingly; document all tox environments except pur

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
webknjaz pushed a commit that referenced this issue Apr 10, 2019
PR #1886 by @themr0c 

Fixes #1885
Fixes #1764

Signed-off-by: Fabrice Flore-Thebault <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants