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

fix namespace #418

Merged
merged 2 commits into from
Mar 3, 2023
Merged

fix namespace #418

merged 2 commits into from
Mar 3, 2023

Conversation

clarkliming
Copy link
Contributor

close #417

@shajoezhu
Copy link
Contributor

@clarkliming , number changed a lot, are they ok?

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

🧪 $Test coverage: 91.62%$

Code Coverage Summary

Filename                     Stmts    Miss  Cover    Missing
-------------------------  -------  ------  -------  ------------------------------------------------------------------------
R/aet01_aesi.R                 187       8  95.72%   37, 39-43, 266, 278
R/aet01.R                      328       6  98.17%   36, 238, 250, 312, 318, 544
R/aet02.R                      219       2  99.09%   129, 469
R/aet03.R                       83       0  100.00%
R/aet04.R                      105       2  98.10%   162, 167
R/assertions.R                  64       0  100.00%
R/checks.R                      20       0  100.00%
R/chevron_tlg-S4class.R         21       0  100.00%
R/chevron_tlg-S4methods.R      131      13  90.08%   43, 408-480
R/cmt01a.R                     189       0  100.00%
R/cmt02_pt.R                    51       0  100.00%
R/dmt01.R                       40       0  100.00%
R/dst01.R                      283       0  100.00%
R/dtht01.R                     102       0  100.00%
R/egt01.R                       45       0  100.00%
R/egt02.R                       58       0  100.00%
R/egt03.R                      130       3  97.69%   114, 158, 311
R/egt05_qtcat.R                 55       0  100.00%
R/ext01.R                       79       8  89.87%   230-233, 237-240
R/gen_args.R                     1       1  0.00%    29
R/lbt01.R                       94       0  100.00%
R/lbt04.R                       51       1  98.04%   120
R/lbt05.R                       75      10  86.67%   32-40, 145
R/lbt07.R                       86       1  98.84%   164
R/lbt14.R                      200      34  83.00%   53, 55, 103-106, 108-116, 146, 175, 257, 259, 307-310, 312-320, 350, 379
R/mht01.R                       71       2  97.18%   32-33
R/mng01.R                       93      12  87.10%   110, 114-117, 126-134, 177
R/pdt01.R                       60      37  38.33%   34-50, 102-142
R/pdt02.R                       67       0  100.00%
R/utils.R                      194     136  29.90%   70, 83-241, 402
R/vst01.R                       47       0  100.00%
R/vst02.R                      100       3  97.00%   40, 114, 245
TOTAL                         3329     279  91.62%

Diff against main

Filename      Stmts    Miss  Cover
----------  -------  ------  -------
R/utils.R        +6      +6  -0.95%
TOTAL            +6      +6  -0.17%

Results for commit: 2f83c76b4b232b4ffa905938041c272025df784d

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

Unit Tests Summary

    1 files    26 suites   1m 40s ⏱️
129 tests   91 ✔️ 38 💤 0
277 runs  186 ✔️ 91 💤 0

Results for commit 3e239d1.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2023

Unit Test Performance Difference

Test Suite $Status$ Time on main $±Time$ $±Tests$ $±Skipped$ $±Failures$ $±Errors$
default_tlg 💔 $39.79$ $+2.52$ $0$ $0$ $0$ $0$

Results for commit 2f83c76b4b232b4ffa905938041c272025df784d

♻️ This comment has been updated with latest results.

@clarkliming
Copy link
Contributor Author

@shajoezhu in #385 this PR changes a lot of the snapshots. Here it is reverted back.

previous changes should not lead to successful github check actions. Do you have any idea why it passed?

@clarkliming clarkliming requested a review from shajoezhu March 3, 2023 05:34
3 10 (7.5%) 16 (11.9%) 13 (9.8%)
4 12 (9.0%) 11 (8.2%) 13 (9.8%)
Any 55 (41.0%) 56 (41.8%) 62 (47.0%)
1 18 (13.4%) 16 (12.0%) 18 (13.6%)
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this happening?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

there are three instances of sample in the syn_test_data that generate the data for testing for adlb (here

sample(x = c("LAST", "REPLICATED", "SINGLE"), size = n(), replace = TRUE, prob = c(0.3, 0.6, 0.1)),
and below.) Please set seed of find another way to generate data. Cheers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

seed are already set and this should not change anything

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the seed should be set in the test itself if something is generated anew there

Copy link
Contributor

Choose a reason for hiding this comment

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

but adlb is generated beforehand is it?

Copy link
Contributor

@BFalquet BFalquet Mar 3, 2023

Choose a reason for hiding this comment

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

seeds are consumed by first usage of the sample e.g.

> library(dplyr)
> 
> set.seed(840)
> m2 <- mtcars %>% 
+   mutate(s1 = sample(c("A", "B"), nrow(.env$mtcars), prob= c(0.5, 0.5), replace = TRUE)) %>% 
+   mutate(s2 = sample(c("A", "B"), nrow(.env$mtcars), prob= c(0.5, 0.5), replace = TRUE))
>
> identical(m2$s1, m2$s2)
[1] FALSE

can be fixed by the ugly:

> m3 <- mtcars %>% 
+   mutate(s1 = {
+     set.seed(840)
+     sample(c("A", "B"), nrow(.env$mtcars), prob= c(0.5, 0.5), replace = TRUE)
+     }) %>% 
+   mutate(s2 = {
+     set.seed(840)
+     sample(c("A", "B"), nrow(.env$mtcars), prob= c(0.5, 0.5), replace = TRUE)
+   })
> 
> identical(m3$s1, m3$s2)
[1] TRUE

Copy link
Contributor

Choose a reason for hiding this comment

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

I always thought it was scope-wise, i.e. valid for each "block" of code. This is not a big problem in other stuff I guess because we always have only one sample per testing block. I think we need to fix the seed for every call then!! Nice catch Benoit

Copy link
Contributor

@Melkiades Melkiades left a comment

Choose a reason for hiding this comment

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

Lgtm anyway, if we can guarantee this is not changing in the next PR due to data reinitialization. It is necessary though to do testthat::snapshot_accept(<FILE>) before all to accept the changes in _snaps and avoid the .new files

@BFalquet
Copy link
Contributor

BFalquet commented Mar 3, 2023

Lgtm anyway, if we can guarantee this is not changing in the next PR due to data reinitialization. It is necessary though to do testthat::snapshot_accept(<FILE>) before all to accept the changes in _snaps and avoid the .new files

Use fix mentioned above if necessary

@clarkliming
Copy link
Contributor Author

Lgtm anyway, if we can guarantee this is not changing in the next PR due to data reinitialization. It is necessary though to do testthat::snapshot_accept(<FILE>) before all to accept the changes in _snaps and avoid the .new files

I think these new files are also created in #385 . in this PR these new files are removed

Copy link
Contributor

@Melkiades Melkiades left a comment

Choose a reason for hiding this comment

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

You are right @clarkliming! I think we can eventually fix the sample problem after this

Copy link
Contributor

@Melkiades Melkiades left a comment

Choose a reason for hiding this comment

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

Lgtm! Thanks Emily for the fix and Benoit for catching the problem ;)

@BFalquet BFalquet self-requested a review March 3, 2023 16:37
Copy link
Contributor

@BFalquet BFalquet left a comment

Choose a reason for hiding this comment

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

Works for me too, clear for merge, thanks a lot

@BFalquet BFalquet merged commit 3fe94ba into main Mar 3, 2023
@BFalquet BFalquet deleted the 417_fix_namespace@main branch March 3, 2023 19:41
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.

fix namespace confilct in rlistings/rtables
5 participants