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

Wrap tests/doctests into with_unicode(false) #3271

Merged
merged 2 commits into from
Feb 9, 2024

Conversation

lgoettgens
Copy link
Member

Needs Nemocas/AbstractAlgebra.jl#1586.

If one has unicode enabled and runs tests/doctests/doctest_fix locally, this may lead to inconsistent results (as the printing may use unicode).
This PR wraps all of these functions into a block that disables unicode temporarily to get consistent output.

@benlorenz
Copy link
Member

I think calling it in each test_module will lead to race-conditions when running the tests in parallel since each allow_unicode will try to write to the same LocalPreferences.toml (twice). It would be good to have some way to override the setting without storing it.

@lgoettgens
Copy link
Member Author

I didn't realize that test_module is called in runtests.jl, I thought this was just for interactive use

@fingolfin
Copy link
Member

Regarding @benlorenz's comment, I've opened Nemocas/AbstractAlgebra.jl#1588

@lgoettgens
Copy link
Member Author

Now that Nemocas/AbstractAlgebra.jl#1586 is available, there are no longer any race conditions between different workers as with_unicode now uses a global variable instead of the file.
allow_unicode(something; temporary=false) leads to weird effects if used in a test file (as it is called inside a with_unicode block in test_module). Thus, I adapted all of these to only change this temporarily.

Copy link

codecov bot commented Feb 7, 2024

Codecov Report

Merging #3271 (141794b) into master (968e9e4) will decrease coverage by 0.02%.
Report is 1 commits behind head on master.
The diff coverage is 43.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3271      +/-   ##
==========================================
- Coverage   81.81%   81.80%   -0.02%     
==========================================
  Files         556      556              
  Lines       74134    74150      +16     
==========================================
+ Hits        60653    60656       +3     
- Misses      13481    13494      +13     
Files Coverage Δ
src/utils/tests.jl 67.77% <67.74%> (+0.36%) ⬆️
src/utils/docs.jl 1.17% <0.00%> (-0.05%) ⬇️

... and 2 files with indirect coverage changes

Copy link
Member

@benlorenz benlorenz left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of this, seems to work fine.

I did some local tests with several Oscar instances using the same directory, running with many workers and tests + doctests in parallel.

@benlorenz benlorenz merged commit 4876a85 into oscar-system:master Feb 9, 2024
22 of 23 checks passed
@lgoettgens lgoettgens deleted the lg/unicode-testing branch February 9, 2024 09:32
ooinaruhugh pushed a commit to ooinaruhugh/Oscar.jl that referenced this pull request Feb 15, 2024
* Wrap tests/doctests into `with_unicode(false)`

* Adapt all `allow_unicode` in test files
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.

3 participants