From 9e9079bf3aae0e538dc24aae64ae7c2ed2a16364 Mon Sep 17 00:00:00 2001 From: mpadge Date: Sun, 16 Feb 2025 16:15:48 +0100 Subject: [PATCH 1/2] rm test expectations for #271 --- DESCRIPTION | 2 +- codemeta.json | 2 +- cran-comments.md | 10 +++----- tests/testthat/test-dists-categorical.R | 10 ++++---- tests/testthat/test-dists-nearest.R | 2 +- tests/testthat/test-dists.R | 34 +++++++------------------ tests/testthat/test-iso.R | 4 +-- 7 files changed, 23 insertions(+), 41 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index cdaa69ed..566dd199 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dodgr Title: Distances on Directed Graphs -Version: 0.4.1.052 +Version: 0.4.1.053 Authors@R: c( person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")), person("Andreas", "Petutschnig", role = "aut"), diff --git a/codemeta.json b/codemeta.json index 1ace646a..9776ef3a 100644 --- a/codemeta.json +++ b/codemeta.json @@ -11,7 +11,7 @@ "codeRepository": "https://github.com/UrbanAnalyst/dodgr", "issueTracker": "https://github.com/UrbanAnalyst/dodgr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.4.1.052", + "version": "0.4.1.053", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", diff --git a/cran-comments.md b/cran-comments.md index 263e7ad4..985298cd 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,10 +1,8 @@ -# CRAN notes for dodgr_0.4.1 submission +# CRAN notes for dodgr_0.4.2 submission -This submission fixes previous warnings from g++ 14.x which arose on CRAN Fedora checks. +This submission fixes the test failures seen on current CRAN version. -It also rectifies one NOTE on namespace imports not used. - -This submission generates the following NOTES on some systems: +Beyond that, this submission generates the following NOTES on some systems: - Possibly invalid URLs, all of which are GitHub because of "Too Many Requests," and not because of the URLs themselves. * "GNU make is a SystemRequirements", which is unavoidable because of the need to remove compiled object files in src sub-directories. @@ -12,6 +10,6 @@ This submission generates the following NOTES on some systems: Other than these, this submission generates no additional notes, and no warnings on: -* Ubuntu 22.04: R-release, R-devel +* Ubuntu 24.04: R-release, R-devel * win-builder (R-release, R-devel, R-oldrelease) - clang UBSAN on R-devel diff --git a/tests/testthat/test-dists-categorical.R b/tests/testthat/test-dists-categorical.R index 1899dfd8..68791191 100644 --- a/tests/testthat/test-dists-categorical.R +++ b/tests/testthat/test-dists-categorical.R @@ -9,7 +9,7 @@ if (!test_all) { test_that ("categorical dists", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) nf <- 100 nt <- 50 @@ -94,7 +94,7 @@ test_that ("categorical dists results", { test_that ("categorical dists summary", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) graph <- graph [graph$component == 1, ] v <- dodgr_vertices (graph) @@ -113,7 +113,7 @@ test_that ("categorical dists summary", { test_that ("proportions only", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) graph <- graph [graph$component == 1, ] v <- dodgr_vertices (graph) @@ -141,7 +141,7 @@ test_that ("proportions only", { test_that ("categorical threshold", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) graph <- graph [graph$component == 1, ] v <- dodgr_vertices (graph) @@ -163,7 +163,7 @@ test_that ("categorical threshold", { test_that ("categorical pairwise", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) graph <- graph [graph$component == 1, ] v <- dodgr_vertices (graph) diff --git a/tests/testthat/test-dists-nearest.R b/tests/testthat/test-dists-nearest.R index 939ec3df..c3ee644d 100644 --- a/tests/testthat/test-dists-nearest.R +++ b/tests/testthat/test-dists-nearest.R @@ -7,7 +7,7 @@ if (!test_all) { test_that ("categorical nearest dists", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) nf <- 50 nt <- 100 diff --git a/tests/testthat/test-dists.R b/tests/testthat/test-dists.R index a439bb35..5953a529 100644 --- a/tests/testthat/test-dists.R +++ b/tests/testthat/test-dists.R @@ -6,7 +6,7 @@ if (!test_all) { } test_that ("dists", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) nf <- 100 nt <- 50 set.seed (1) @@ -74,7 +74,7 @@ test_that ("dists", { }) test_that ("dists-pairwise", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) n <- 50 set.seed (1) from <- sample (graph$from_id, size = n) @@ -314,26 +314,10 @@ test_that ("heaps", { dodgr_dists (graph, from = from, to = to, heap = "wrong heap"), "'arg' should be one of" ) - expect_silent (d0 <- dodgr_dists (graph, - from = from, - to = to, - heap = "BHeap" - )) - expect_silent (d1 <- dodgr_dists (graph, - from = from, - to = to, - heap = "FHeap" - )) - expect_silent (d3 <- dodgr_dists (graph, - from = from, - to = to, - heap = "TriHeap" - )) - expect_silent (d4 <- dodgr_dists (graph, - from = from, - to = to, - heap = "TriHeapExt" - )) + d0 <- dodgr_dists (graph, from = from, to = to, heap = "BHeap") + d1 <- dodgr_dists (graph, from = from, to = to, heap = "FHeap") + d3 <- dodgr_dists (graph, from = from, to = to, heap = "TriHeap") + d4 <- dodgr_dists (graph, from = from, to = to, heap = "TriHeapExt") # This is a compound message that starts "Calculating shortest paths ..." # and then "Extended TriHeaps can not be calculated in parallel # That can't be tested, so just generic expect_message here @@ -341,7 +325,7 @@ test_that ("heaps", { from = from, to = to, heap = "TriHeapExt", quiet = FALSE )) - expect_silent (d5 <- dodgr_dists (graph, from = from, to = to, heap = "Heap23")) + d5 <- dodgr_dists (graph, from = from, to = to, heap = "Heap23") d4 <- dodgr_dists (graph, from = from, @@ -365,7 +349,7 @@ test_that ("heaps", { }) test_that ("graph columns", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) nf <- 100 nt <- 50 set.seed (1) @@ -395,7 +379,7 @@ test_that ("graph columns", { }) test_that ("negative weights", { - expect_silent (graph <- weight_streetnet (hampi)) + graph <- weight_streetnet (hampi) nf <- 100 nt <- 50 set.seed (1) diff --git a/tests/testthat/test-iso.R b/tests/testthat/test-iso.R index 05cb2409..56780668 100644 --- a/tests/testthat/test-iso.R +++ b/tests/testthat/test-iso.R @@ -12,9 +12,9 @@ test_that ("isodists", { # This all exists just to test the next line: requireNamespace ("geodist") requireNamespace ("dplyr") - expect_no_message (net <- weight_streetnet (hsc, + net <- weight_streetnet (hsc, wt_profile = "bicycle" - )) + ) npts <- 100 set.seed (1) from <- sample (net$.vx0, size = npts) From 352bfe103321cc4323b49946b346e86ce8baf60b Mon Sep 17 00:00:00 2001 From: mpadge Date: Sun, 16 Feb 2025 16:20:26 +0100 Subject: [PATCH 2/2] protect main branch from direct commits --- .hooks/no-commit-to-main | 6 ++++++ .pre-commit-config.yaml | 4 ++++ DESCRIPTION | 2 +- codemeta.json | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100755 .hooks/no-commit-to-main diff --git a/.hooks/no-commit-to-main b/.hooks/no-commit-to-main new file mode 100755 index 00000000..6467f2c9 --- /dev/null +++ b/.hooks/no-commit-to-main @@ -0,0 +1,6 @@ +#!/usr/bin/env Rscript + +# do not commit to main branch +on_main <- identical (gert::git_branch (), "main") +if (on_main) + stop ("main branch is protected on GitHub; commits must be made via PR from other branch") diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b0a97b37..6067fad4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -76,6 +76,10 @@ repos: name: Version has been incremeneted in DESCRIPTION entry: .hooks/description language: script + - id: Commit via PR only + name: Commit made to non-main branch + entry: .hooks/no-commit-to-main + language: script ci: autoupdate_schedule: monthly diff --git a/DESCRIPTION b/DESCRIPTION index 566dd199..d1fd6e5c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dodgr Title: Distances on Directed Graphs -Version: 0.4.1.053 +Version: 0.4.1.054 Authors@R: c( person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre")), person("Andreas", "Petutschnig", role = "aut"), diff --git a/codemeta.json b/codemeta.json index 9776ef3a..fc727cbb 100644 --- a/codemeta.json +++ b/codemeta.json @@ -11,7 +11,7 @@ "codeRepository": "https://github.com/UrbanAnalyst/dodgr", "issueTracker": "https://github.com/UrbanAnalyst/dodgr/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.4.1.053", + "version": "0.4.1.054", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R",