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

Allow users to find usages of py.local #10199

Closed
kasium opened this issue Aug 10, 2022 · 5 comments · Fixed by #10331
Closed

Allow users to find usages of py.local #10199

kasium opened this issue Aug 10, 2022 · 5 comments · Fixed by #10331
Labels
type: docs documentation improvement, missing or needing clarification

Comments

@kasium
Copy link

kasium commented Aug 10, 2022

What's the problem this feature will solve?

As far as I understand, py (especially py.local) and related fixtures like tempdir should be replace with pathlib and their corresponding fixtures like tmp_path. In large code bases switching is a longer task and requires multiple commits and work of multiple people

Describe the solution you'd like

It would be great if there would be an option to block the usage of these "old" fixtures, e.g. by a "future mode" or a warning which can be changed to an error with warning filters.

With this,

  1. it is easy to find, where a code change is needed
  2. after switching to pathlib only, future usage is blocked

Alternative Solutions

  • Using a linter, which is quite hard tue the dynamic calculation of fixtures
@The-Compiler
Copy link
Member

The-Compiler commented Aug 10, 2022

What "related fixtures" do you have in mind? I can only think of tmpdir, tmpdir_factory and testdir (for testing pytest plugins, not loaded by default).

All those are already part of an internal legacypath plugin (#9208), so if all you want is to disable tmpdir and tmpdir_factory, running pytest with -p no:legacypath-tmpdir should do the job (it also works as part of addopts in the config file). Maybe we should document this somewhere though? What do you think, @bluetech?

@kasium
Copy link
Author

kasium commented Aug 10, 2022

@The-Compiler exactly these fixtures and the plugin sounds great. Some documentation would be great 😄

@Zac-HD Zac-HD added the type: docs documentation improvement, missing or needing clarification label Aug 12, 2022
@sgaist
Copy link
Contributor

sgaist commented Sep 28, 2022

Hi,

That's indeed a neat trick to know when modernizing old code bases.

Can I be assigned this documentation improvement for Hacktober fest ?

@RonnyPfannschmidt
Copy link
Member

Based on effects in previous years I think I'd like to opt out of the hacktoberfest

@sgaist
Copy link
Contributor

sgaist commented Sep 28, 2022

Sorry to read you had a bad experience.

The event has turned into an opt-in mode since last year at least so you should be able to do that without any problem.

In any case, my documentation update offer still holds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs documentation improvement, missing or needing clarification
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants