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

Pytest locally fails due to API_KEY env variable #8738

Merged
merged 2 commits into from
Jun 3, 2023

Conversation

CaedenPH
Copy link
Contributor

Describe your change:

Fixes #8737

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

@CaedenPH CaedenPH requested a review from cclauss as a code owner May 15, 2023 16:09
@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels May 15, 2023
@CaedenPH
Copy link
Contributor Author

@cclauss Could you review please? The issue number is also in the description, as well as the pr message

@cclauss cclauss changed the title Pytest locally fails due to API_KEY env variable (#8737) Pytest locally fails due to API_KEY env variable May 28, 2023
@cclauss
Copy link
Member

cclauss commented Jun 3, 2023

I do not understand why these changes are required.

  • Did you get an API key from AMDOREN
  • Did you put that API key into an exported environment variable AMDOREN_API_KEY before running the code?

@CaedenPH
Copy link
Contributor Author

CaedenPH commented Jun 3, 2023

I do not understand why these changes are required.

  • Did you get an API key from AMDOREN
  • Did you put that API key into an exported environment variable AMDOREN_API_KEY before running the code?

@cclauss No I did not, but why should someone have to make an account from some website, get an api key and export this api key just to run local tests? It doesn't make any sense that one algorithm causes such a hassle

In this discussion #8791 people are confused why running the tests locally fails due to one algorithm.

This change does not break the algorithm, just moves getting the API_KEY into the if __name__ == "__main__" block to allow the tests to pass.

Copy link
Member

@cclauss cclauss left a comment

Choose a reason for hiding this comment

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

Now I understand. CI is not defined on localhost thus...

Thanks for the explanation.

@cclauss cclauss merged commit 80d95fc into TheAlgorithms:master Jun 3, 2023
@CaedenPH CaedenPH deleted the fix-pytest-error branch June 3, 2023 16:32
sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* fix: Pytest locally fails due to API_KEY env variable (TheAlgorithms#8737)

* chore: Fix ruff errors
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running pytest locally fails due to no TESTING or API_KEY
2 participants