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

increase code coverage for the R-package #313

Merged
merged 5 commits into from
Dec 13, 2019
Merged

Conversation

mlampros
Copy link
Collaborator

@mlampros mlampros commented Nov 30, 2019

I've added code coverage as discussed in #269. The only exception is the cleanup() method (either for a single estimator or for all estimators) which is tested (currently) on a unix-like OS. Feel free to close #269 if this PR works as expected.

One think that I've noticed is that the 'save_model' and 'dump_model' methods work only for RGF and not for FastRGF. thanks.

@StrikerRUS
Copy link
Member

@mlampros Thank you very much for this PR!

Seems that two of new tests don't work on macOS:

* checking tests ...
  Running ‘testthat.R’ [22s/22s]
 ERROR
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
  > 
  > test_check("RGF")
  ── 1. Failure: the 'cleanup' method (ESTIMATOR specific) works as expected for b
  init_exists_upd_rgf && end_state_rgf && end_state_fastrgf isn't true.
  
  ── 2. Failure: the 'cleanup' method (APPLIES TO ALL ESTIMATORS) works as expecte
  &&... isn't true.
  
  ══ testthat results  ═══════════════════════════════════════════════════════════
  [ OK: 13 | SKIPPED: 0 | WARNINGS: 0 | FAILED: 2 ]
  1. Failure: the 'cleanup' method (ESTIMATOR specific) works as expected for both RGF and FastRGF (checking of the length of the '/tmp/rgf' default directory before and after the '$fit' method) (@test-RGF_package.R#501) 
  2. Failure: the 'cleanup' method (APPLIES TO ALL ESTIMATORS) works as expected for both RGF and FastRGF (checking of the length of the '/tmp/rgf' default directory before and after the '$fit' method) (@test-RGF_package.R#535) 
  
  Error: testthat unit tests failed
  Execution halted

@mlampros
Copy link
Collaborator Author

@StrikerRUS, I assumed that Mac osx will have the same temporary folder as on linux ('/tmp').
Is it ok if I restrict the cleanup() test only to the linux os? The cleanup() function is already tested on Python, and the R package doesn't do anything else than calling the python function from within R.

@StrikerRUS
Copy link
Member

@mlampros I guess you can use tempdir() function as well as some environment variables to locate temp directory in a cross-platform way and don't hardcode it.

@mlampros
Copy link
Collaborator Author

@StrikerRUS,
thanks for make me aware of the one-liner dirname(tempdir()),
I think it will do the work. If not then I'll use the accepted answer of the second web-link
that you've mentioned.

Copy link
Member

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

@mlampros Thank you! Please check some my comments about tests below.

R-package/tests/testthat/test-RGF_package.R Outdated Show resolved Hide resolved
R-package/tests/testthat/test-RGF_package.R Outdated Show resolved Hide resolved
R-package/tests/testthat/test-RGF_package.R Outdated Show resolved Hide resolved
R-package/tests/testthat/test-RGF_package.R Show resolved Hide resolved
@fukatani
Copy link
Member

@mlampros Sorry for late response. Are you debugging failure on appveyor?

@mlampros
Copy link
Collaborator Author

@fukatani, I'll add the remaining tests for this PR tonight. I think, the appveyor error is a connection failure, so with a re-run it will disappear. thanks.

Copy link
Member

@StrikerRUS StrikerRUS left a comment

Choose a reason for hiding this comment

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

@mlampros Thank you very much for your hard work! I left some minor comments below.

Comment on lines +20 to 22
A Fast Regularized Greedy Forest classifier

A Fast Regularized Greedy Forest classifier
Copy link
Member

Choose a reason for hiding this comment

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

Are these duplicated lines expected or it is a bug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure. The previous .Rd file consisted of a single line. The .Rd file is the manual page of the corresponding .R file. It has to do with the roxygen2 package and how it builds the manual pages from the .R files (I've used the roxygen2 7.0.2 version for this PR)

R-package/tests/testthat/test-RGF_package.R Outdated Show resolved Hide resolved
R-package/tests/testthat/test-RGF_package.R Outdated Show resolved Hide resolved
\description{
Regularized Greedy Forest regressor
Copy link
Member

Choose a reason for hiding this comment

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

This line is needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The previous .Rd file consisted of a single line. The .Rd file is the manual page of the corresponding .R file. It has to do with the roxygen2 package and how it builds the manual pages from the .R files (I've used the roxygen2 7.0.2 version for this PR)

Copy link
Member

@fukatani fukatani left a comment

Choose a reason for hiding this comment

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

LGTM excepts above the comment.

@mlampros mlampros merged commit b30b3b6 into master Dec 13, 2019
@StrikerRUS StrikerRUS deleted the R-package-code-coverage branch December 14, 2019 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

[R-package] increase the code coverage of R-package
3 participants