Skip to content

Conversation

@breno-jesus-fernandes
Copy link
Contributor

@breno-jesus-fernandes breno-jesus-fernandes commented Jun 29, 2022

Basically, now my_path.pth is created and destroyed after tests.
Fix #37

@breno-jesus-fernandes breno-jesus-fernandes changed the title Fix #37 issue Fix issue #37 Jun 29, 2022
Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

Need to only have changes related to fixing the mypy_path.pth file, and account for a possible failure.

subprocess.run(cmd, check=True)


def add_last_changes():
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be part of a different PR



def run_mypy_dist():
create_mypy_pkg_file()
Copy link
Collaborator

Choose a reason for hiding this comment

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

When testing the distribution, you do NOT want to have this file present, as the distribution is installed

subprocess.run(cmd, check=True)


def restore_last_changes():
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be a different PR

def run_mypy_src():
create_mypy_pkg_file()
cmd = ["mypy", "pandas-stubs", "tests", "--no-incremental"]
subprocess.run(cmd, check=True)
Copy link
Collaborator

Choose a reason for hiding this comment

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

If for some reason this fails, the file would still be there. Can't you use the rollback technique you have used elsewhere in case of failure?

@Dr-Irv Dr-Irv changed the title Fix issue #37 Fix issue #37 : Create my_path.pth only for local mypy test, remove afterwards Jun 29, 2022

steps.extend([
Step(name="Create mypy package file", run=procedures.create_mypy_pkg_file),
Step(name="Run Mypy Against Source Code", run=procedures.run_mypy_src),
Copy link
Collaborator

Choose a reason for hiding this comment

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

don't you need a rollback here?

from scripts._job import Step, run_job

def create_mypy_pkg_file():
pkg_path = [path for path in sys.path if path.endswith('site-packages')]
Copy link
Member

Choose a reason for hiding this comment

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

A contextmanager would here also be nice, but I'm not sure whether that fits easily in the structure of having multiple steps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it could work using tempfile lib, thx.

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jul 2, 2022

Can you merge with main and resolve conflicts?

@breno-jesus-fernandes
Copy link
Contributor Author

Can you merge with main and resolve conflicts?

Done

Breno Fernandes added 2 commits July 2, 2022 21:15
# Conflicts:
#	pyproject.toml
#	scripts/test/__init__.py
#	scripts/test/procedures.py
@Dr-Irv Dr-Irv merged commit ab80de3 into pandas-dev:main Jul 3, 2022
@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Jul 3, 2022

Thanks @BrenoJesusFernandes

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.

poetry creates my_paths.pth in environment - should get removed

3 participants