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

If TOX_WORK_DIR is indicated in the environment, honor it. #1653

Closed

Conversation

jaraco
Copy link

@jaraco jaraco commented Aug 15, 2020

Closes #20.

Contribution checklist:

(also see CONTRIBUTING.rst for details)

  • wrote descriptive pull request text
  • added/updated test(s)
  • updated/extended the documentation
  • added relevant issue keyword
    in message body
  • added news fragment in changelog folder
    • fragment name: <issue number>.<type>.rst for example (588.bugfix.rst)
    • <type> is must be one of bugfix, feature, deprecation,breaking, doc, misc
    • if PR has no issue: consider creating one first or change it to the PR number after creating the PR
    • "sign" fragment with "by :user:<your username>"
    • please use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files - by :user:superuser."
    • also see examples
  • added yourself to CONTRIBUTORS (preserving alphabetical order)

@jaraco
Copy link
Author

jaraco commented Aug 15, 2020

I've tried testing this change, but I'm unable to install it from source on Python 3.6 as found on Ubuntu Bionic:

Step 8/13 : RUN pip3 install git+https://github.com/jaraco/tox@feature/environment-workdir-override
 ---> Running in 7b18356563aa
Collecting git+https://github.com/jaraco/tox@feature/environment-workdir-override
  Cloning https://github.com/jaraco/tox (to feature/environment-workdir-override) to /tmp/pip-dp4bxhxb-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-dp4bxhxb-build/setup.py", line 18, in <module>
        package_dir={"": "src"},
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 128, in setup
        _install_setup_requires(attrs)
      File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 121, in _install_setup_requires
        dist.parse_config_files(ignore_option_errors=True)
      File "/usr/lib/python3/dist-packages/setuptools/dist.py", line 491, in parse_config_files
        _Distribution.parse_config_files(self, filenames=filenames)
      File "/usr/lib/python3.6/distutils/dist.py", line 395, in parse_config_files
        parser.read(filename)
      File "/usr/lib/python3.6/configparser.py", line 697, in read
        self._read(fp, filename)
      File "/usr/lib/python3.6/configparser.py", line 1015, in _read
        for lineno, line in enumerate(fp, start=1):
      File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
        return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 263: ordinal not in range(128)

sigh

@asottile
Copy link
Contributor

try setting LANG=C.UTF-8 in your docker image?

@jaraco
Copy link
Author

jaraco commented Aug 15, 2020

Okay, so setting the encoding in the image allows tox to install, but now it's installing as version 0.0.0 and fails on startup:

Step 13/14 : RUN tox -e pypy3 --notest
 ---> Running in c315bbb725dd
Traceback (most recent call last):
  File "/usr/local/bin/tox", line 11, in <module>
    load_entry_point('tox==0.0.0', 'console_scripts', 'tox')()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 480, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2693, in load_entry_point
    return ep.load()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/local/lib/python3.6/dist-packages/tox/__init__.py", line 14, in <module>
    from .version import __version__
ModuleNotFoundError: No module named 'tox.version'

@asottile
Copy link
Contributor

ah, that'd be too-old pip or too-old setuptools (probably both actually)

@jaraco
Copy link
Author

jaraco commented Aug 15, 2020

I'll bet I need to --use-pep517.

@jaraco
Copy link
Author

jaraco commented Aug 15, 2020

Indeed - upgrading pip worked!

And I've confirmed that the change has some effect, but not the fully-intended effect:

Step 12/15 : ENV TOX_WORK_DIR=/.tox
 ---> Running in 9e360101a9c1
Removing intermediate container 9e360101a9c1
 ---> 732b901c0dcf
Step 13/15 : WORKDIR /setuptools
 ---> Running in b8a2068e3753
Removing intermediate container b8a2068e3753
 ---> 2b0b227cc4b7
Step 14/15 : RUN tox -e pypy3 --notest
 ---> Running in 4fc1a57bfdf6
.tox create: /.tox/.tox
.tox installdeps: tox-pip-version >= 0.0.6, tox >= 3.2
pypy3 create: /setuptools/.tox/pypy3

There are several things not working as intended here.

  • tox-pip-version is installed to the same environment as tox, so there should be no need for a .tox/.tox, but it does create it.
  • When creating .tox/.tox, it uses the TOX_WORK_DIR. That's good.
  • But, when creating the environment for the tox-env, it doesn't honor TOX_WORK_DIR.

@jaraco
Copy link
Author

jaraco commented Aug 15, 2020

This isn't an easy fix as I'd hoped. I'm giving up. I'd still like to see a fix for #20, but I'm already shaving too many yaks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command-line option for overriding toxworkdir
2 participants