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

MAINT make pytest collection ignore folders with Python scripts #12011

Merged
merged 1 commit into from
Sep 5, 2018

Conversation

ogrisel
Copy link
Member

@ogrisel ogrisel commented Sep 5, 2018

Some IDEs such as VS Code use the pytest command to collect all the tests of
the workspace in the background. This can cause unexpected execution of
arbitrary Python scripts in the workspace (examples, benchmarks...).

The doc folder is also ignored because it has python scripts for sphinx
along with copies of the examples.

To safely run pytest in the doc folder, we need to use the find command
to find all "*.rst" files as done in the project Makefile.

Some IDEs such as VS Code use the pytest command to collect all the tests of
the workspace in the background. This can cause unexpected execution of
arbitrary Python scripts in the workspace (examples, benchmarks...).

The doc folder is also ignored because it has python scripts for sphinx
along with copies of the examples.

To safely run pytest in the doc folder, we need to used the find command
to find all "*.rst" files as done in the project Makefile.
Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

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

LMTM, thanks!

There were some earlier stalled approaches to fix this #9839 that had finer granularity for doc/, but I think this is fine; and we can fine tune that later.

@ogrisel ogrisel merged commit 242410f into scikit-learn:master Sep 5, 2018
@ogrisel ogrisel deleted the pytest-ignore branch September 5, 2018 15:33
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Sep 6, 2018
…it-learn#12011)

Some IDEs such as VS Code use the pytest command to collect all the tests of
the workspace in the background. This can cause unexpected execution of
arbitrary Python scripts in the workspace (examples, benchmarks...).

The doc folder is also ignored because it has python scripts for sphinx
along with copies of the examples.

To safely run pytest in the doc folder, we need to used the find command
to find all "*.rst" files as done in the project Makefile.
jnothman pushed a commit to jnothman/scikit-learn that referenced this pull request Sep 17, 2018
…it-learn#12011)

Some IDEs such as VS Code use the pytest command to collect all the tests of
the workspace in the background. This can cause unexpected execution of
arbitrary Python scripts in the workspace (examples, benchmarks...).

The doc folder is also ignored because it has python scripts for sphinx
along with copies of the examples.

To safely run pytest in the doc folder, we need to used the find command
to find all "*.rst" files as done in the project Makefile.
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.

2 participants