[Debian-med-packaging] Bug#891947: r-cran-dplyr: autopkgtest regressions

Steve Langasek steve.langasek at canonical.com
Sat Mar 3 00:23:14 UTC 2018


Package: r-cran-dplyr
Version: 0.7.4-2
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch autopkgtest

Hi Andreas,

r-cran-dplyr has recently started failing its autopkgtests in Debian and Ubuntu:

== testthat results  ===========================================================
OK: 2657 SKIPPED: 11 FAILED: 4
1. Failure: Non-ascii column names in version 0.3 are not duplicated (#636) (@test-mutate.r#400) 
2. Error: mutate() supports unquoted values (@test-mutate.r#721) 
3. Failure: summarise() supports unquoted values (@test-summarise.r#980) 
4. Error: summarise() supports unquoted values (@test-summarise.r#985) 

Error: testthat unit tests failed
Execution halted
autopkgtest [18:49:31]: test run-unit-test: -----------------------]

(https://ci.debian.net/packages/r/r-cran-dplyr/unstable/amd64/)

I don't know what triggered the behavior change, but the tests are
definitely buggy.

I've applied the following patch to r-cran-dplyr in Ubuntu, consisting of
one upstream cherry-pick and a change to the test environment, fixing the
failures.

It seems likely that debian/patches/skip-utf8-tests.patch can also be
dropped now as unnecessary, when setting a sensible UTF-8 default
environment.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek at ubuntu.com                                     vorlon at debian.org
-------------- next part --------------
diff -Nru r-cran-dplyr-0.7.4/debian/patches/0001-Use-instead-of-UQ-and-fix-operator-precedence.patch r-cran-dplyr-0.7.4/debian/patches/0001-Use-instead-of-UQ-and-fix-operator-precedence.patch
--- r-cran-dplyr-0.7.4/debian/patches/0001-Use-instead-of-UQ-and-fix-operator-precedence.patch	1969-12-31 16:00:00.000000000 -0800
+++ r-cran-dplyr-0.7.4/debian/patches/0001-Use-instead-of-UQ-and-fix-operator-precedence.patch	2018-03-02 16:17:37.000000000 -0800
@@ -0,0 +1,163 @@
+From 866df054d1d08fcfa687bb4feb0313ae053e125d Mon Sep 17 00:00:00 2001
+From: Lionel Henry <lionel.hry at gmail.com>
+Date: Sat, 30 Dec 2017 15:46:01 +0100
+Subject: [PATCH] Use !! instead of UQ() and fix operator precedence
+
+---
+ R/compat-dbplyr.R                     | 11 ++++++-----
+ R/funs-predicates.R                   |  2 +-
+ tests/testthat/test-hybrid-traverse.R |  2 +-
+ tests/testthat/test-hybrid.R          |  2 +-
+ tests/testthat/test-mutate.r          | 20 ++++++++++----------
+ tests/testthat/test-summarise.r       | 18 +++++++++---------
+ vignettes/compatibility.Rmd           |  2 +-
+ 7 files changed, 29 insertions(+), 28 deletions(-)
+
+Index: r-cran-dplyr-0.7.4/R/compat-dbplyr.R
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/R/compat-dbplyr.R
++++ r-cran-dplyr-0.7.4/R/compat-dbplyr.R
+@@ -35,8 +35,8 @@
+     args <- formals()
+     pass_on <- map(set_names(names(args)), sym)
+ 
+-    dbplyr_call <- expr(UQ(dbplyr_sym)(!!!pass_on))
+-    dplyr_call <- expr(UQ(dplyr_sym)(!!!pass_on))
++    dbplyr_call <- expr((!!dbplyr_sym)(!!! pass_on))
++    dplyr_call <- expr((!!dplyr_sym)(!!! pass_on))
+   } else {
+     args <- list()
+ 
+@@ -47,15 +47,16 @@
+   body <- expr({
+     if (utils::packageVersion("dplyr") > "0.5.0") {
+       dplyr::check_dbplyr()
+-      UQ(dbplyr_call)
++      !!dbplyr_call
+     } else {
+-      UQ(dplyr_call)
++      !!dplyr_call
+     }
+   })
+   wrapper <- new_function(args, body, caller_env())
+ 
+-  expr(UQ(obj_sym) <- UQE(wrapper))
++  expr(!!obj_sym <- !!get_expr(wrapper))
+ }
++utils::globalVariables("!<-")
+ 
+ #' @inherit dbplyr::sql
+ #' @export
+Index: r-cran-dplyr-0.7.4/R/funs-predicates.R
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/R/funs-predicates.R
++++ r-cran-dplyr-0.7.4/R/funs-predicates.R
+@@ -43,6 +43,6 @@
+   op_quo <- as_quosure(.op, base_env())
+   op <- f_rhs(op_quo)
+ 
+-  expr <- reduce(dots, function(x, y) expr(UQ(op)((!! x), (!! y))))
++  expr <- reduce(dots, function(x, y) expr((!!op)((!! x), (!! y))))
+   new_quosure(expr, f_env(op_quo))
+ }
+Index: r-cran-dplyr-0.7.4/tests/testthat/test-hybrid-traverse.R
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/tests/testthat/test-hybrid-traverse.R
++++ r-cran-dplyr-0.7.4/tests/testthat/test-hybrid-traverse.R
+@@ -189,7 +189,7 @@
+     expect_equal(
+       test_df %>%
+         grouping %>%
+-        mutate(., f = mean(UQ(var))) %>%
++        mutate(., f = mean(!!var)) %>%
+         select(-e),
+       test_df %>%
+         grouping %>%
+Index: r-cran-dplyr-0.7.4/tests/testthat/test-hybrid.R
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/tests/testthat/test-hybrid.R
++++ r-cran-dplyr-0.7.4/tests/testthat/test-hybrid.R
+@@ -800,7 +800,7 @@
+ test_that("%in% handler supports quosured symbols", {
+   `%in%` <- bad_hybrid_handler
+   expect_identical(
+-    pull(mutate(mtcars, UQ(quo(cyl)) %in% 4)),
++    pull(mutate(mtcars, !!quo(cyl) %in% 4)),
+     base::`%in%`(mtcars$cyl, 4)
+   )
+ })
+Index: r-cran-dplyr-0.7.4/tests/testthat/test-mutate.r
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/tests/testthat/test-mutate.r
++++ r-cran-dplyr-0.7.4/tests/testthat/test-mutate.r
+@@ -710,18 +710,18 @@
+ 
+ test_that("mutate() supports unquoted values", {
+   df <- tibble(g = c(1, 1, 2, 2, 2), x = 1:5)
+-  expect_identical(mutate(df, out = !! 1), mutate(df, out = 1))
+-  expect_identical(mutate(df, out = !! 1:5), mutate(df, out = 1:5))
+-  expect_identical(mutate(df, out = !! quote(1:5)), mutate(df, out = 1:5))
+-  expect_error(mutate(df, out = !! 1:2), "must be length 5 (the number of rows)", fixed = TRUE)
+-  expect_error(mutate(df, out = !! get_env()), "unsupported type")
++  expect_identical(mutate(df, out = !!1), mutate(df, out = 1))
++  expect_identical(mutate(df, out = !!(1:5)), mutate(df, out = 1:5))
++  expect_identical(mutate(df, out = !!quote(1:5)), mutate(df, out = 1:5))
++  expect_error(mutate(df, out = !!(1:2)), "must be length 5 (the number of rows)", fixed = TRUE)
++  expect_error(mutate(df, out = !!get_env()), "unsupported type")
+ 
+   gdf <- group_by(df, g)
+-  expect_identical(mutate(gdf, out = !! 1), mutate(gdf, out = 1))
+-  expect_identical(mutate(gdf, out = !! 1:5), group_by(mutate(df, out = 1:5), g))
+-  expect_error(mutate(gdf, out = !! quote(1:5)), "must be length 2 (the group size)", fixed = TRUE)
+-  expect_error(mutate(gdf, out = !! 1:2), "must be length 5 (the number of rows)", fixed = TRUE)
+-  expect_error(mutate(gdf, out = !! get_env()), "unsupported type")
++  expect_identical(mutate(gdf, out = !!1), mutate(gdf, out = 1))
++  expect_identical(mutate(gdf, out = !!(1:5)), group_by(mutate(df, out = 1:5), g))
++  expect_error(mutate(gdf, out = !!quote(1:5)), "must be length 2 (the group size)", fixed = TRUE)
++  expect_error(mutate(gdf, out = !!(1:2)), "must be length 5 (the number of rows)", fixed = TRUE)
++  expect_error(mutate(gdf, out = !!get_env()), "unsupported type")
+ })
+ 
+ 
+Index: r-cran-dplyr-0.7.4/tests/testthat/test-summarise.r
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/tests/testthat/test-summarise.r
++++ r-cran-dplyr-0.7.4/tests/testthat/test-summarise.r
+@@ -975,15 +975,15 @@
+ 
+ test_that("summarise() supports unquoted values", {
+   df <- tibble(g = c(1, 1, 2, 2, 2), x = 1:5)
+-  expect_identical(summarise(df, out = !! 1), tibble(out = 1))
+-  expect_identical(summarise(df, out = !! quote(identity(1))), tibble(out = 1))
+-  expect_error(summarise(df, out = !! 1:2), "must be length 1 (the number of groups)", fixed = TRUE)
+-  expect_error(summarise(df, out = !! env(a = 1)), "unsupported type")
++  expect_identical(summarise(df, out = !!1), tibble(out = 1))
++  expect_identical(summarise(df, out = !!quote(identity(1))), tibble(out = 1))
++  expect_error(summarise(df, out = !!(1:2)), "must be length 1 (the number of groups)", fixed = TRUE)
++  expect_error(summarise(df, out = !!env(a = 1)), "unsupported type")
+ 
+   gdf <- group_by(df, g)
+-  expect_identical(summarise(gdf, out = !! 1), summarise(gdf, out = 1))
+-  expect_identical(summarise(gdf, out = !! 1:2), tibble(g = c(1, 2), out = 1:2))
+-  expect_identical(summarise(gdf, out = !! quote(identity(1))), summarise(gdf, out = 1))
+-  expect_error(summarise(gdf, out = !! 1:5), "must be length 2 (the number of groups)", fixed = TRUE)
+-  expect_error(summarise(gdf, out = !! env(a = 1)), "unsupported type")
++  expect_identical(summarise(gdf, out = !!1), summarise(gdf, out = 1))
++  expect_identical(summarise(gdf, out = !!(1:2)), tibble(g = c(1, 2), out = 1:2))
++  expect_identical(summarise(gdf, out = !!quote(identity(1))), summarise(gdf, out = 1))
++  expect_error(summarise(gdf, out = !!(1:5)), "must be length 2 (the number of groups)", fixed = TRUE)
++  expect_error(summarise(gdf, out = !!env(a = 1)), "unsupported type")
+ })
+Index: r-cran-dplyr-0.7.4/vignettes/compatibility.Rmd
+===================================================================
+--- r-cran-dplyr-0.7.4.orig/vignettes/compatibility.Rmd
++++ r-cran-dplyr-0.7.4/vignettes/compatibility.Rmd
+@@ -157,7 +157,7 @@
+ quo(my_call(!!! syms))
+ 
+ fun <- rlang::sym("my_call")
+-quo(UQ(fun)(!!! syms))
++quo((!!fun)(!!! syms))
+ ```
+ 
+ Or create the call with `lang()`:
diff -Nru r-cran-dplyr-0.7.4/debian/patches/series r-cran-dplyr-0.7.4/debian/patches/series
--- r-cran-dplyr-0.7.4/debian/patches/series	2017-11-09 04:46:33.000000000 -0800
+++ r-cran-dplyr-0.7.4/debian/patches/series	2018-03-02 15:51:05.000000000 -0800
@@ -1,2 +1,3 @@
 use_debian_packages_boost.patch
 skip-utf8-tests.patch
+0001-Use-instead-of-UQ-and-fix-operator-precedence.patch
diff -Nru r-cran-dplyr-0.7.4/debian/tests/run-unit-test r-cran-dplyr-0.7.4/debian/tests/run-unit-test
--- r-cran-dplyr-0.7.4/debian/tests/run-unit-test	2017-10-01 09:23:15.000000000 -0700
+++ r-cran-dplyr-0.7.4/debian/tests/run-unit-test	2018-03-02 16:16:32.000000000 -0800
@@ -17,4 +17,4 @@
     fi
 done
 sed -i '/[Ll]ahman/d' testthat.R
-LC_ALL=C R --no-save < testthat.R
+LC_ALL=C.UTF-8 R --no-save < testthat.R


More information about the Debian-med-packaging mailing list