Skip to content

Commit abb423a

Browse files
shapiromhMatthew Shapiropre-commit-ci[bot]s3alfisc
authored
Reorganize Tests against R (#906)
* Update project toml with conda-forge available R packages * Added new pytest marks for r_against_core and r_against_extended * Updated packages to install for extended R environment * Added test markers in pytest init and related pixi dev tasks * Moved the extended mark of a fixture to the relevant function so pytest stops complaining * Adjusted extended R test scripts to skip over modules not properly installed * Updated R requirements to correct install issues. * Added skip summary on tasks that may cover R tests * Updated the documentation around changes to R tests. * Added R as dependency to docs as well to avoid need for global install * UNTESTED: Updated git workflow actions to reflect new R install? * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * pixi lock * Made changes to make car a core R package * Added check on mpdata availability * Fix: forgot to label car tests as core instead of extended * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Matthew Shapiro <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Alexander Fischer <[email protected]>
1 parent cf4ab3f commit abb423a

17 files changed

+5108
-1081
lines changed

.github/workflows/ci-tests.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: |
4747
R_LIB_PATH="${{ github.workspace }}/.pixi/envs/dev/lib/R/library"
4848
mkdir -p $R_LIB_PATH
49-
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages(c('fixest', 'broom','did2s', 'wildrwolf', 'ivDiag', 'car'), lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library')"
49+
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages(c('did2s', 'wildrwolf', 'ivDiag'), lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library', repos = c('https://cran.rstudio.com', 'https://s3alfisc.r-universe.dev'))"
5050
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages('ritest', lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library', repos = c('https://grantmcdermott.r-universe.dev'))"
5151
- name: Run 'regular' tests
5252
run: |
@@ -94,11 +94,12 @@ jobs:
9494
run: |
9595
R_LIB_PATH="${{ github.workspace }}/.pixi/envs/dev/lib/R/library"
9696
mkdir -p $R_LIB_PATH
97-
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages(c('fixest', 'broom','did2s', 'wildrwolf', 'ivDiag', 'car'), lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library')"
97+
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages(c('did2s', 'wildrwolf', 'ivDiag'), lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library', repos = c('https://cran.rstudio.com', 'https://s3alfisc.r-universe.dev'))"
9898
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages('ritest', lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library', repos = c('https://grantmcdermott.r-universe.dev'))"
9999
- name: Run tests against r
100100
run: |
101-
pixi run tests-against-r
101+
pixi run tests-against-r-core
102+
pixi run tests-against-r-extended
102103
103104
- name: Upload coverage to Codecov (partial)
104105
uses: codecov/codecov-action@v4

.github/workflows/extended_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ jobs:
4444
run: |
4545
R_LIB_PATH="${{ github.workspace }}/.pixi/envs/dev/lib/R/library"
4646
mkdir -p $R_LIB_PATH
47-
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages(c('fixest', 'broom','did2s', 'wildrwolf', 'ivDiag', 'car'), lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library')"
47+
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages(c('did2s', 'wildrwolf', 'ivDiag'), lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library', repos = c('https://cran.rstudio.com', 'https://s3alfisc.r-universe.dev'))"
4848
Rscript -e ".libPaths('$R_LIB_PATH'); install.packages('ritest', lib='/home/runner/work/pyfixest/pyfixest/.pixi/envs/dev/lib/R/library', repos = c('https://grantmcdermott.r-universe.dev'))"
4949
- name: Run long tests with coverage
50-
run: pixi r tests-extended
50+
run: pixi run tests-extended
5151

5252
- name: Upload coverage to Codecov (partial)
5353
uses: codecov/codecov-action@v4

docs/contributing.qmd

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,17 @@ pixi run lint
9090

9191
and you're ready to go! After installation, the task will run all linting rules via `ruff`.
9292

93-
We’ve included other tasks to help install the necessary R packages for running unit tests or to run different sets of tests:
93+
We’ve included other tasks to help with testing. Almost all the necessary dependencies to run tests are included in the dev environment,
94+
except for R packages unavailable through conda-forge.
9495
```{.bash .code-copy}
95-
# install all R development dependencies
96-
pixi run install-r
96+
# attempt to install non-conda R dependencies
97+
pixi run install-r-extended
9798
# run all tests via pytest
9899
pixi run tests
99-
# run all tests excluding very computationally demanding tests
100+
# run all tests excluding very computationally demanding tests or R-based tests
100101
pixi run tests-regular
102+
# run all tests that depend on the extra R dependencies
103+
pixi run tests-against-r-extended
101104
# rerun failed tests
102105
pixi run tests-rerun
103106
```
@@ -132,26 +135,10 @@ winget install -e --id Python.Python.3.11
132135

133136
### Installing R
134137

135-
Note that installing R and the R packages listed below is only necessary if you want to test against R in your local installation.
136-
You can also test against R by using github actions.
138+
Note that R and R dependencies available through conda-forge are installed by pixi to the local project if you use the dev environment.
139+
Some extra R dependencies may require additional development tools not included in the environment, for example:
137140

138-
On Mac/Linux:
139-
```{.bash .code-copy}
140-
brew install r
141-
```
142-
143-
Depending on your local set up, you may need to install additional libraries, for
144-
example:
145-
146-
```{.bash .code-copy}
147-
sudo apt install gcc-11 cmake
148-
```
149-
150-
On Windows using [Winget](https://winget.run/pkg/RProject/R):
151-
152-
```{.bash .code-copy}
153-
winget install -e --id RProject.R
154-
```
141+
Depending on your local set up, you may need to install additional libraries to compile those extra dependencies, like a version of `gcc` and `cmake`.
155142

156143
### Installing Quarto
157144

0 commit comments

Comments
 (0)