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

Fix terminal size in tox commands (#2999) #3139

Merged
merged 1 commit into from Oct 20, 2023

Conversation

ziima
Copy link
Contributor

@ziima ziima commented Oct 13, 2023

Found it! And because it took me 6 hours to debug it, I'm going to describe how the debugging went.

At first, I started debugging the tox itself. Quickly I managed to discover, the issue can be triggered by python3 -c "from prompt_toolkit import prompt; prompt('Give me some input: ')" which behaved differently in tox and outside. After couple of hours trying to navigate the tox internals I landed at ReadViaThreadUnix where I noticed it print a significant number of '\r\n' pairs after the prompt. That led me to the prompt_toolkit. I spend some time there, until I discovered the screen it renders within tox has an unusual height. A but later I noticed the screen it tries to render have switched values of columns and rows when compared to COLUMNS and ROWS pass in env values by tox. Bit more digging lead to os.get_terminal_size(). The MWE was now just simply:

[testenv]
deps = ipython
commands =
    python3 -c "import os; print(os.get_terminal_size())"
# tox
py: commands[0]> python3 -c 'import os; print(os.get_terminal_size())'
os.terminal_size(columns=54, lines=189)

# .tox/py/bin/python3 -c 'import os; print(os.get_terminal_size())'
os.terminal_size(columns=189, lines=54)

I had no idea what to do now, but I didn't want to give up. I realized I could just grep tox source code for columns and I finally found match in _pty function. I tried to switch the two arguments and voila, works like a charm.

This PR is not yet finished, I haven't found how to design a test for this and I'm too tired at the moment. I hope to add it soon.

  • ran the linter to address style issues (tox -e fix)
  • wrote descriptive pull request text
  • ensured there are test(s) validating the fix
  • added news fragment in docs/changelog folder
  • updated/extended the documentation

@ziima
Copy link
Contributor Author

ziima commented Oct 17, 2023

PR is ready.

@gaborbernat gaborbernat merged commit bab2d2a into tox-dev:main Oct 20, 2023
24 of 25 checks passed
descope bot added a commit to descope/django-descope that referenced this pull request Dec 30, 2023
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [tox](https://togithub.com/tox-dev/tox)
([changelog](https://tox.wiki/en/latest/changelog.html)) | dev | minor |
`4.5.1` -> `4.11.4` |

---

### Release Notes

<details>
<summary>tox-dev/tox (tox)</summary>

### [`v4.11.4`](https://togithub.com/tox-dev/tox/releases/tag/4.11.4)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.11.3...4.11.4)

#### What's Changed

- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3124
- Fix `quickstart` command from requiring `root` positional argument by
[@&#8203;Tbruno25](https://togithub.com/Tbruno25) in
[tox-dev/tox#3123
- docs(config): fix default value for install_command by
[@&#8203;hashar](https://togithub.com/hashar) in
[tox-dev/tox#3126
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3128
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3132
- Added Python 3.12 in installation docs by
[@&#8203;mj0nez](https://togithub.com/mj0nez) in
[tox-dev/tox#3133
- Fix terminal size in tox commands
([#&#8203;2999](https://togithub.com/tox-dev/tox/issues/2999)) by
[@&#8203;ziima](https://togithub.com/ziima) in
[tox-dev/tox#3139
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3135
- Use the new ruff formatter over black by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3142
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3147
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3149
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3154
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3161
- docs(config): Fix base_python default reference by
[@&#8203;rpatterson](https://togithub.com/rpatterson) in
[tox-dev/tox#3156
- Fixed 'AppData' not passed to env by default
([#&#8203;3151](https://togithub.com/tox-dev/tox/issues/3151)) by
[@&#8203;Stefanhg](https://togithub.com/Stefanhg) in
[tox-dev/tox#3160

#### New Contributors

- [@&#8203;mj0nez](https://togithub.com/mj0nez) made their first
contribution in
[tox-dev/tox#3133
- [@&#8203;Stefanhg](https://togithub.com/Stefanhg) made their first
contribution in
[tox-dev/tox#3160

**Full Changelog**:
tox-dev/tox@4.11.3...4.11.4

### [`v4.11.3`](https://togithub.com/tox-dev/tox/releases/tag/4.11.3)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.11.2...4.11.3)

#### What's Changed

- docs(plugin): explain plugin registration by
[@&#8203;hashar](https://togithub.com/hashar) in
[tox-dev/tox#3116
- Fix error caused by a bad `base_python` path by
[@&#8203;Tbruno25](https://togithub.com/Tbruno25) in
[tox-dev/tox#3122

#### New Contributors

- [@&#8203;hashar](https://togithub.com/hashar) made their first
contribution in
[tox-dev/tox#3116

**Full Changelog**:
tox-dev/tox@4.11.2...4.11.3

### [`v4.11.2`](https://togithub.com/tox-dev/tox/releases/tag/4.11.2)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.11.1...4.11.2)

#### What's Changed

- Fix typos discovered by codespell by
[@&#8203;cclauss](https://togithub.com/cclauss) in
[tox-dev/tox#3113
- Bump actions/checkout from 3 to 4 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[tox-dev/tox#3114
- Providing example to make CLI help more helpful for -x,--override by
[@&#8203;posita](https://togithub.com/posita) in
[tox-dev/tox#3119
- Remove stray colons in `config.rst` left over from
[#&#8203;3111](https://togithub.com/tox-dev/tox/issues/3111) by
[@&#8203;posita](https://togithub.com/posita) in
[tox-dev/tox#3120

#### New Contributors

- [@&#8203;cclauss](https://togithub.com/cclauss) made their first
contribution in
[tox-dev/tox#3113
- [@&#8203;posita](https://togithub.com/posita) made their first
contribution in
[tox-dev/tox#3119

**Full Changelog**:
tox-dev/tox@4.11.1...4.11.2

### [`v4.11.1`](https://togithub.com/tox-dev/tox/releases/tag/4.11.1)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.11.0...4.11.1)

#### What's Changed

- Tests: Don't assume Python 3.10 is always installed, use current
Python version by [@&#8203;hroncok](https://togithub.com/hroncok) in
[tox-dev/tox#3108
- Set the --parallel default to "auto", not CPU count by
[@&#8203;paravoid](https://togithub.com/paravoid) in
[tox-dev/tox#3109
- Fix , being used as value parser for env var configs by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3111

**Full Changelog**:
tox-dev/tox@4.11.0...4.11.1

### [`v4.11.0`](https://togithub.com/tox-dev/tox/releases/tag/4.11.0)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.10.0...4.11.0)

#### What's Changed

- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3102
- Fix type checker and bump tools by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3107
- Add config_settings support for build backend calls by
[@&#8203;nschloe](https://togithub.com/nschloe) in
[tox-dev/tox#3090

#### New Contributors

- [@&#8203;nschloe](https://togithub.com/nschloe) made their first
contribution in
[tox-dev/tox#3090

**Full Changelog**:
tox-dev/tox@4.10.0...4.11.0

### [`v4.10.0`](https://togithub.com/tox-dev/tox/releases/tag/4.10.0)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.9.0...4.10.0)

#### What's Changed

- Set basepython for docs env in alignment to Read the Docs default by
[@&#8203;jugmac00](https://togithub.com/jugmac00) in
[tox-dev/tox#3097
- Document release process by
[@&#8203;jugmac00](https://togithub.com/jugmac00) in
[tox-dev/tox#3094
- Replace undefined settings with overrides when appending by
[@&#8203;stefanor](https://togithub.com/stefanor) in
[tox-dev/tox#3101
- Accept environments with defined factors or of python selector form -
suggest closest by [@&#8203;BeyondEvil](https://togithub.com/BeyondEvil)
in
[tox-dev/tox#3099

#### New Contributors

- [@&#8203;BeyondEvil](https://togithub.com/BeyondEvil) made their first
contribution in
[tox-dev/tox#3099

**Full Changelog**:
tox-dev/tox@4.9.0...4.10.0

### [`v4.9.0`](https://togithub.com/tox-dev/tox/releases/tag/4.9.0)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.8.0...4.9.0)

#### What's Changed

- Disallow command line environments which are not explicitly specified
in the config file by [@&#8203;tjsmart](https://togithub.com/tjsmart) in
[tox-dev/tox#3089
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3091

#### New Contributors

- [@&#8203;tjsmart](https://togithub.com/tjsmart) made their first
contribution in
[tox-dev/tox#3089

**Full Changelog**: tox-dev/tox@4.8.0...4.9.0

### [`v4.8.0`](https://togithub.com/tox-dev/tox/releases/tag/4.8.0)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.7.0...4.8.0)

#### What's Changed

- Correct "notset" typo in --hashseed's --help text. by
[@&#8203;lamby](https://togithub.com/lamby) in
[tox-dev/tox#3082
- Bump pypa/gh-action-pypi-publish from 1.8.8 to 1.8.10 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[tox-dev/tox#3085
- Allow extending lists with --override foo+=bar by
[@&#8203;stefanor](https://togithub.com/stefanor) in
[tox-dev/tox#3088

#### New Contributors

- [@&#8203;lamby](https://togithub.com/lamby) made their first
contribution in
[tox-dev/tox#3082
- [@&#8203;stefanor](https://togithub.com/stefanor) made their first
contribution in
[tox-dev/tox#3088

**Full Changelog**: tox-dev/tox@4.7.0...4.8.0

### [`v4.7.0`](https://togithub.com/tox-dev/tox/releases/tag/4.7.0)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.6.4...4.7.0)

#### What's Changed

- Fix doc alignment and link check by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3059
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3061
- Bump pypa/gh-action-pypi-publish from 1.8.7 to 1.8.8 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[tox-dev/tox#3063
- Update a test regex to work with Python 3.12+ by
[@&#8203;hroncok](https://togithub.com/hroncok) in
[tox-dev/tox#3066
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3067
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3070
- Remove broken link by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3072
- Add sponsor button for tidelift by
[@&#8203;jugmac00](https://togithub.com/jugmac00) in
[tox-dev/tox#3079
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3081
- Make --hashseed default to PYTHONHASHSEED, if defined by
[@&#8203;paravoid](https://togithub.com/paravoid) in
[tox-dev/tox#3076

**Full Changelog**: tox-dev/tox@4.6.4...4.7.0

### [`v4.6.4`](https://togithub.com/tox-dev/tox/releases/tag/4.6.4)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.6.3...4.6.4)

#### What's Changed

- Ensure tox r -e docs generates the documentation by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3047
- \[pre-commit.ci] pre-commit autoupdate by
[@&#8203;pre-commit-ci](https://togithub.com/pre-commit-ci) in
[tox-dev/tox#3051
- Bump pypa/gh-action-pypi-publish from 1.8.6 to 1.8.7 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[tox-dev/tox#3052
- s/setup.cfg/pyproject.toml/ in the development docs by
[@&#8203;sk1p](https://togithub.com/sk1p) in
[tox-dev/tox#3058
- Fix hang and zombie process on interrupt (CTRL-C). by
[@&#8203;sk1p](https://togithub.com/sk1p) in
[tox-dev/tox#3057

**Full Changelog**: tox-dev/tox@4.6.3...4.6.4

### [`v4.6.3`](https://togithub.com/tox-dev/tox/releases/tag/4.6.3)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.6.2...4.6.3)

#### What's Changed

- Made issue template have less whitespace by
[@&#8203;jamesbraza](https://togithub.com/jamesbraza) in
[tox-dev/tox#3038
- Docs link of env var subs section to `set_env` by
[@&#8203;jamesbraza](https://togithub.com/jamesbraza) in
[tox-dev/tox#3039
- Removed duplicate text in bug report template by
[@&#8203;jamesbraza](https://togithub.com/jamesbraza) in
[tox-dev/tox#3040
- Ensure `get_requires*` hook is called before `prepare_metadata*` by
[@&#8203;abravalheri](https://togithub.com/abravalheri) in
[tox-dev/tox#3044

#### New Contributors

- [@&#8203;jamesbraza](https://togithub.com/jamesbraza) made their first
contribution in
[tox-dev/tox#3038
- [@&#8203;abravalheri](https://togithub.com/abravalheri) made their
first contribution in
[tox-dev/tox#3044

**Full Changelog**: tox-dev/tox@4.6.2...4.6.3

### [`v4.6.2`](https://togithub.com/tox-dev/tox/releases/tag/4.6.2)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.6.1...4.6.2)

#### What's Changed

- Avoid cache collision between wheel and editable wheel builds by
[@&#8203;f3flight](https://togithub.com/f3flight) in
[tox-dev/tox#3035

**Full Changelog**: tox-dev/tox@4.6.1...4.6.2

### [`v4.6.1`](https://togithub.com/tox-dev/tox/releases/tag/4.6.1)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.6.0...4.6.1)

#### What's Changed

- Update `usedevelop` doc by referring to PEP-660. by
[@&#8203;tibortakacs](https://togithub.com/tibortakacs) in
[tox-dev/tox#3025
- Use ruff by [@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3033

#### New Contributors

- [@&#8203;tibortakacs](https://togithub.com/tibortakacs) made their
first contribution in
[tox-dev/tox#3025

**Full Changelog**: tox-dev/tox@4.6.0...4.6.1

### [`v4.6.0`](https://togithub.com/tox-dev/tox/releases/tag/4.6.0)

[Compare Source](https://togithub.com/tox-dev/tox/compare/4.5.2...4.6.0)

#### What's Changed

- Remove unnecessary Future usage by
[@&#8203;living180](https://togithub.com/living180) in
[tox-dev/tox#3020
- Test against 3.12.0-beta.1 by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3022
- Add --list-dependencies options by
[@&#8203;lengau](https://togithub.com/lengau) in
[tox-dev/tox#3024

#### New Contributors

- [@&#8203;living180](https://togithub.com/living180) made their first
contribution in
[tox-dev/tox#3020
- [@&#8203;lengau](https://togithub.com/lengau) made their first
contribution in
[tox-dev/tox#3024

**Full Changelog**: tox-dev/tox@4.5.2...4.6.0

### [`v4.5.2`](https://togithub.com/tox-dev/tox/releases/tag/4.5.2)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.5.1.1...4.5.2)

#### What's Changed

- Add 3.12 support by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#2998
- Bump pypa/gh-action-pypi-publish from 1.8.5 to 1.8.6 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[tox-dev/tox#3003
- Update list of maintainers by
[@&#8203;jugmac00](https://togithub.com/jugmac00) in
[tox-dev/tox#3008
- fix legacy `tox --devenv venv` by
[@&#8203;asottile](https://togithub.com/asottile) in
[tox-dev/tox#3013
- Fix legacy devenv by
[@&#8203;gaborbernat](https://togithub.com/gaborbernat) in
[tox-dev/tox#3019

**Full Changelog**: tox-dev/tox@4.5.1...4.5.2

###
[`v4.5.1.1`](https://togithub.com/tox-dev/tox/compare/4.5.1...4.5.1.1)

[Compare
Source](https://togithub.com/tox-dev/tox/compare/4.5.1...4.5.1.1)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://togithub.com/renovatebot/renovate).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy42NC4yIiwidXBkYXRlZEluVmVyIjoiMzcuNjQuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: descope[bot] <descope[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants