Skip to content

Commit 5ed7210

Browse files
authored
Merge pull request #290 from cmu-delphi/test-saf
Disable stringsAsFactors during unit testing
2 parents 6013d6c + dc7595d commit 5ed7210

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

.github/workflows/r_ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
steps:
2828
- uses: actions/checkout@v2
2929
- name: Set up R ${{ matrix.r-version }}
30-
uses: r-lib/actions/setup-r@ffe45a39586f073cc2e9af79c4ba563b657dc6e3
30+
uses: r-lib/actions/setup-r@v1
3131
with:
3232
r-version: ${{ matrix.r-version }}
3333
- name: Install libcurl
@@ -36,7 +36,7 @@ jobs:
3636
uses: actions/cache@v2
3737
with:
3838
path: ${{ env.R_LIBS_USER }}
39-
key: ${{ runner.os }}-r-1-
39+
key: ${{ runner.os }}-r-2-
4040
- name: Install dependencies
4141
run: |
4242
install.packages(c("remotes", "rcmdcheck"))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Many tests use hand-made reference data frames. In R < 4.0, columns like
2+
# `geo_values` and `data_source`, containing strings, are interpreted as
3+
# factors. To prevent us from having to set stringsAsFactors = FALSE in every
4+
# test case, set the option while saving the default to restore in the teardown
5+
# (in teardown-options.R).
6+
.defaultStringsAsFactors <- options(stringsAsFactors = FALSE)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# see setup-options.R
2+
options(stringsAsFactors = .defaultStringsAsFactors)

0 commit comments

Comments
 (0)