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

Make tests 168,2043 work for any LC_TIME #4719

Merged
merged 4 commits into from
Sep 26, 2020
Merged

Make tests 168,2043 work for any LC_TIME #4719

merged 4 commits into from
Sep 26, 2020

Conversation

tdhock
Copy link
Member

@tdhock tdhock commented Sep 26, 2020

Closes #3450
hi @jangorecki @shrektan @2005m @MichaelChirico this is a fix for #3450 which you commented on.
The problem in that issue is that some of the computed values depend on the LC_TIME locale value, whereas the expected values in the test are always English/C locale (Jan/NOV).
On my system (ubuntu 18.04) I have the following locales, the important one is LC_TIME=fr_FR.UTF-8

Fri Sep 25 16:41:56 2020  endian==little, sizeof(long double)==16, longdouble.digits==64, sizeof(pointer)==8, TZ==unset, Sys.timezone()=='America/Phoenix', Sys.getlocale()=='LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=fr_FR.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=fr_FR.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=C', l10n_info()=='MBCS=TRUE; UTF-8=TRUE; Latin-1=FALSE', getDTthreads()=='omp_get_num_procs()==2; R_DATATABLE_NUM_PROCS_PERCENT==unset (default 50); R_DATATABLE_NUM_THREADS==unset; R_DATATABLE_THROTTLE==unset (default 1024); omp_get_thread_limit()==2147483647; omp_get_max_threads()==2; OMP_THREAD_LIMIT==unset; OMP_NUM_THREADS==unset; RestoreAfterFork==true; data.table is using 1 threads with throttle==1024. See ?setDTthreads.'

with current master I get

(base) tdhock@maude-MacBookPro:~/R$ R CMD INSTALL data.table && R --vanilla < data.table/tests/main.R 
...
  7 errors out of 9996. Search tests/tests.Rraw.bz2 for test numbers: 168.1, 168.2, 168.3, 2042.2, 2042.3, 2127.26, 2127.27.

After applying the commit in this PR I get

All 10001 tests in tests/tests.Rraw completed ok in 00:01:50 elapsed (00:01:46 cpu)

I could have fixed this by just setting LC_TIME=C during the tests, but I figured it would be better to not alter the environment. So instead I just changed the expected values so that they are generated based on the current locale (e.g. "janv." and "nov." instead of "Jan" and "NOV"). Is this approach ok?

@codecov
Copy link

codecov bot commented Sep 26, 2020

Codecov Report

Merging #4719 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4719   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files          73       73           
  Lines       14539    14539           
=======================================
  Hits        14458    14458           
  Misses         81       81           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1cc5c0c...e3bc071. Read the comment docs.

@MichaelChirico
Copy link
Member

LGTM thanks!

@tdhock
Copy link
Member Author

tdhock commented Sep 26, 2020

great thanks! @mattdowle would you consider merging please?

@jangorecki jangorecki added this to the 1.13.1 milestone Sep 26, 2020
@MichaelChirico
Copy link
Member

MichaelChirico commented Sep 26, 2020 via email

@tdhock
Copy link
Member Author

tdhock commented Sep 26, 2020

haha no rush

@jangorecki jangorecki removed this from the 1.13.1 milestone Sep 26, 2020
Copy link
Member

@mattdowle mattdowle left a comment

Choose a reason for hiding this comment

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

Great. Had a look. It just needs a short news item (notes section), and the ", #3450" adding on these lines please.

inst/tests/tests.Rraw Outdated Show resolved Hide resolved
inst/tests/tests.Rraw Outdated Show resolved Hide resolved
@mattdowle
Copy link
Member

As it happens, since CRAN is in error status and this release is pressing, the timing is good at the moment for any quick and easy PRs (like this one) to be prioritized to get them out of the way in 1.13.2. Most of the PRs currently scheduled for next release (milestone 1.13.1) will probably get bumped to 1.13.3 milestone.

@mattdowle mattdowle added this to the 1.13.1 milestone Sep 26, 2020
@tdhock
Copy link
Member Author

tdhock commented Sep 26, 2020

hi @mattdowle thanks for the quick review. here are the issue/PR mentions, is that OK?

@mattdowle
Copy link
Member

Thanks @tdhock. News items have developed a silent standard we should probably write down. We just reference the issue and not the PR too, because the issue itself links to the PR. That keeps the news item briefer, but also 1 link rather than 2 helps the CRAN check times because CRAN checks that every link in NEWS.md works and that can take over 20 mins. Also the name of the user-visible function affected should be present, in this case test.data.table(), and up front, to aid users quickly scanning the news items. It's ok I can tweak the news item, just explaining what's in my mind when I tweak them. We should write this stuff down.

@mattdowle
Copy link
Member

mattdowle commented Sep 26, 2020

@tdhock is the revised news item ok? I'm not sure about the "Jan vs janv." part. Is it J vs j like that, and the French has a dot too? Yep, I set LC_TIME myself and confirmed it is.

@mattdowle mattdowle merged commit e22e659 into master Sep 26, 2020
@mattdowle mattdowle deleted the fix3450 branch September 26, 2020 16:15
@tdhock
Copy link
Member Author

tdhock commented Sep 27, 2020

great thanks for the info

hongyuanjia pushed a commit to hongyuanjia/data.table that referenced this pull request Dec 29, 2023
hongyuanjia pushed a commit to hongyuanjia/data.table that referenced this pull request Dec 29, 2023
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.

Should fix the tests that depends on certain locale
4 participants