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

tests: Add example project for offline builds #340

Merged
merged 8 commits into from
Nov 22, 2023
Merged

Conversation

nbraud
Copy link
Collaborator

@nbraud nbraud commented Nov 17, 2023

  • Add an example project for bork to build in tests without network access
    As a bonus, that's makes for a pretty-fast instance of test_repo

Did some refactorings of tests/ in the process:

  • Refactored test_repos with parametrized fixtures
  • Added helpers.chdir, refactored some more with that

@nbraud nbraud force-pushed the tests/offline branch 2 times, most recently from c706639 to a175102 Compare November 22, 2023 11:44
@nbraud
Copy link
Collaborator Author

nbraud commented Nov 22, 2023

Not too sure what to do about the lint failure in tests/; the lints are erroneous:

  • W0621: “Redefining name 'project_src' from outer scope” will trigger on any fixture which uses another fixture defined in the same file;
  • W0613: “Unused argument 'project'” will trigger on anything using the project fixture and only relying on it setting the working directory.

I guess for now I'll just sprinkle noqa annotations, since:

  • pylint doesn't seem to disable those two lints only in the tests/ directory;
  • disabling them globally seems undesirable;
  • same for not linting tests/ at all.

This way, once the test returns, the working directory returns to what it was.
Noticed in #344:
- `test_repo[bork]` runs `python -m bork` in a copy of the bork repo;
- the Python interpreter looks for the `bork` module, finds the `bork/` folder in the (current) working directory;
- the version of bork being run is the one `project_src` provided, rather than the one pytest was called against.
@duckinator duckinator merged commit 7d94e78 into main Nov 22, 2023
28 checks passed
@duckinator duckinator deleted the tests/offline branch November 22, 2023 18:33
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.

None yet

2 participants