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

Implement temporary fix for CI #376

Merged
merged 1 commit into from
Jan 8, 2025
Merged

Conversation

ElliottKasoar
Copy link
Member

Resolves #372

See also, discussion in pymatgen: materialsproject/pymatgen#4243

I think unsetting CI is the only solution, as I think otherwise os.getenv("CI") is not None evaluates to True, even if CI is set to "", False, etc.

This change should be reverted once #374 is implemented, as we should be able to update monty to include the fix: materialsvirtuallab/monty#735.

@ElliottKasoar ElliottKasoar added testing Unit testing or CI priority Urgent attention required labels Jan 6, 2025
@ElliottKasoar ElliottKasoar added the bug Something isn't working label Jan 6, 2025
@DanielYang59
Copy link

DanielYang59 commented Jan 7, 2025

I think unsetting CI is the only solution, as I think otherwise os.getenv("CI") is not None evaluates to True, even if CI is set to "", False, etc.

AFAIK, to unset an env var (or any other value in yaml in general), you would need to set it to null instead of some other falsy string like "", "false" and so on (because our code doesn't check the "semantic meaning" of the string, but it's presence). Let me know if this doesn't work

@ElliottKasoar
Copy link
Member Author

I think unsetting CI is the only solution, as I think otherwise os.getenv("CI") is not None evaluates to True, even if CI is set to "", False, etc.

AFAIK, to unset an env var (or any other value in yaml in general), you would need to set it to null instead of some other falsy string like "", "false" and so on (because our code doesn't check the "semantic meaning" of the string, but it's presence). Let me know if this doesn't work

I think setting it to null would work it it were directly being read into the Python, but as this is setting the environment variable itself, I think this still ends up roughly equivalent to "" - see failed test and debugging test, where I echo $CI and print os.getenv("CI")/os.getenv("CI") is not None.

(I went through a similar realisation about what monty was doing, initially assuming setting CI to False would would work, before realising it needed to evaluate to None.)

@oerc0122
Copy link
Collaborator

oerc0122 commented Jan 7, 2025

The real problem is that the code is actually checking if "CI" in os.environ rather than checking if os.getenv("CI").lower() in ("true", "1") which would be more useful.

@DanielYang59
Copy link

The real problem is that the code is actually checking if "CI" in os.environ rather than checking if os.getenv("CI").lower() in ("true", "1") which would be more useful.

Yep that was the original implementation (and now we decided to drop this warning/exception completely). This was intended as we anticipate either one of the two situations:

We cannot think of too many cases where the user would need to change the value of CI, therefore we only checked if it's present

This was referenced Jan 7, 2025
@ElliottKasoar ElliottKasoar merged commit fe6e6d9 into stfc:main Jan 8, 2025
8 checks passed
@ElliottKasoar ElliottKasoar deleted the fix-tests branch January 8, 2025 12:54
ElliottKasoar added a commit to ElliottKasoar/janus-core that referenced this pull request Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority Urgent attention required testing Unit testing or CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DeprecationWarning raised in CI
4 participants