Skip to content

Add MYPY_CONFIG_FILE_DIR to environment when config file is read#9403

Merged
gvanrossum merged 4 commits intopython:masterfrom
aghast:env_MYPY_CONFIG_FILE_DIR
Sep 4, 2020
Merged

Add MYPY_CONFIG_FILE_DIR to environment when config file is read#9403
gvanrossum merged 4 commits intopython:masterfrom
aghast:env_MYPY_CONFIG_FILE_DIR

Conversation

@aghast
Copy link
Contributor

@aghast aghast commented Sep 3, 2020

Description

Fixes #7968

The variable MYPY_CONFIG_FILE_DIR is set to the absolute path of (ADDED: the dirname of) the config file, prior to it being parsed. Existing environment-variable substitution should handle the rest.

Test Plan

Added new file test-data/unit/envvars.test to list of test files in mypy/test/testcmdline.py.

Added one testcase, using $MYPY_CONFIG_FILE_DIR to set files= in mypy.ini.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise this looks good to me.

# To run just this test:
# pytest -n0 -k testEnvvar_MYPY_CONFIG_FILE_DIR
[file bogus.py]
FOO: int = 'x'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you looked at the Travis-CI failure? This test fails on Python 3.5.1 because that doesn't support variable declarations. You can use type comments instead.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@gvanrossum gvanrossum merged commit 652aca9 into python:master Sep 4, 2020
@gvanrossum
Copy link
Member

Dang. The tests failed, even though they passed earlier. I don't see how my whitespace-only commit could have caused this, but I'm going to have to revert it, and then we can look into a fix.

gvanrossum added a commit that referenced this pull request Sep 4, 2020
…ead (#9403)"

Reason: This broke CI.

This reverts commit 652aca9.
gvanrossum added a commit that referenced this pull request Sep 4, 2020
Let's see what it will take to make CI pass.

Resubmit of #9403.

Fixes #7968.

Co-authored-by: blueyed
gvanrossum added a commit that referenced this pull request Sep 4, 2020
… try)

Let's see what it will take to make CI pass.

Resubmit of #9403.

Fixes #7968.

Co-authored-by: blueyed
gvanrossum added a commit that referenced this pull request Sep 4, 2020
… try)

Let's see what it will take to make CI pass.

Resubmit of #9403.

Fixes #7968.

Co-authored-by: aghast <aghast@aghast.dev>
gvanrossum added a commit that referenced this pull request Sep 4, 2020
… try) (#9414)

(This fixes the mistake I introduced in the previous version.)

Resubmit of #9403.

Fixes #7968.

Co-authored-by: aghast <aghast@aghast.dev>
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.

Set MYPY_CONFIG_FILE_DIR environment variable

2 participants