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

auto_test_package chokes on tests/testthat directory #138

Closed
doogiecode opened this Issue Mar 18, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@doogiecode

doogiecode commented Mar 18, 2014

Hi there, I just started using testthat and am having a problem when I try to run my tests continuously while I work. I followed the instructions on the Github readme file and set up my tests to all be contained in a directory named testthat in the tests directory of my package. However, when I try to run auto_test_package from the root directory of my package I get this:

> auto_test_package(".")
Public sweetr tests : .....


Error in digest(path, file = TRUE) : 
  The specified pathname is not a file: /Users/proffitt/Code/R/sweetr-package/sweetr/tests/testthat

Is this expected? The command dies at that point and goes back to the R prompt. Any insight would be appreciated.

@doogiecode

This comment has been minimized.

doogiecode commented Mar 18, 2014

KentonWhite added a commit to KentonWhite/testthat that referenced this issue May 30, 2014

Handle directories in tests folder. Fixes r-lib#138
Watchers use digest to efficiently check if a file has changed.
Digest does not handle missing files or directories well. So safe_digest
was written to wrap digest and catch errors.

In b1cb9e8 it was discovered that
the error catching was too optimistic and was eating errors that should
be reported to the user. To fix this, logic was added to catch
the known errors from digest and re-raise all other errors.

The only known error at that time was if the file did not exist.
Unfortunately digest also throws an error if it is passed a directory.
With the introduction of the new testthat tests folder structure,
all tests folders also include a subfolder called testthat. When
digest was passed the folder name it was failing.

Rather than filtering for folder, I've expanded the known errors logic.
The list of known errors is now encapsulated in a known_errors function.
An error is checked against this list, and if it isn't found then the
error is re-raised.

I also ran into problems with the tests in test-watcher. test-watcher
was explicitly testing internal functions, and I was having trouble
with the testing environment not finding these functions. I explicitly
export these functions if they are not in the current testing environment.
This is probably stupid and would love some pointers as to a better way
to test!

KentonWhite added a commit to KentonWhite/testthat that referenced this issue Jun 6, 2014

Handle directories in tests folder. Fixes r-lib#138
Watchers use digest to efficiently check if a file has changed.
Digest does not handle missing files or directories well. So safe_digest
was written to wrap digest and catch errors.

In b1cb9e8 it was discovered that
the error catching was too optimistic and was eating errors that should
be reported to the user. To fix this, logic was added to catch
the known errors from digest and re-raise all other errors.

The only known error at that time was if the file did not exist.
Unfortunately digest also throws an error if it is passed a directory.
With the introduction of the new testthat tests folder structure,
all tests folders also include a subfolder called testthat. When
digest was passed the folder name it was failing.

Rather than filtering for folder, I've expanded the known errors logic.
The list of known errors is now encapsulated in a known_errors function.
An error is checked against this list, and if it isn't found then the
error is re-raised.

KentonWhite added a commit to KentonWhite/testthat that referenced this issue Jun 20, 2014

Handle directories in tests folder. Fixes r-lib#138
Watchers use digest to efficiently check if a file has changed.
Digest does not handle missing files or directories well. So safe_digest
was written to wrap digest and catch errors.

In b1cb9e8 it was discovered that
the error catching was too optimistic and was eating errors that should
be reported to the user. To fix this, logic was added to catch
the known errors from digest and re-raise all other errors.

The only known error at that time was if the file did not exist.
Unfortunately digest also throws an error if it is passed a directory.
With the introduction of the new testthat tests folder structure,
all tests folders also include a subfolder called testthat. When
digest was passed the folder name it was failing.

Rather than filtering for folder, I've expanded the known errors logic.
The list of known errors is now encapsulated in a known_errors function.
An error is checked against this list, and if it isn't found then the
error is re-raised.

KentonWhite added a commit to KentonWhite/testthat that referenced this issue Jun 25, 2014

Handle directories in tests folder. Fixes r-lib#138
Watchers use digest to efficiently check if a file has changed.
Digest does not handle missing files or directories well. So safe_digest
was written to wrap digest and catch errors.

In b1cb9e8 it was discovered that
the error catching was too optimistic and was eating errors that should
be reported to the user. To fix this, logic was added to catch
the known errors from digest and re-raise all other errors.

The only known error at that time was if the file did not exist.
Unfortunately digest also throws an error if it is passed a directory.
With the introduction of the new testthat tests folder structure,
all tests folders also include a subfolder called testthat. When
digest was passed the folder name it was failing.

Rather than filtering for folder, I've expanded the known errors logic.
The list of known errors is now encapsulated in a known_errors function.
An error is checked against this list, and if it isn't found then the
error is re-raised.

@hadley hadley closed this in e3353f7 Sep 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment