Skip to content

Fix order-dependent ASOIAF test skipping data() load before exists() check - #164

Merged
smasongarrison merged 1 commit into
devfrom
copilot/fix-review-comment-3660917598
Jul 27, 2026
Merged

Fix order-dependent ASOIAF test skipping data() load before exists() check#164
smasongarrison merged 1 commit into
devfrom
copilot/fix-review-comment-3660917598

Conversation

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

The ASOIAF test at line 415 of test-kinship2_aligns.R checked exists("ASOIAF") before calling data("ASOIAF"), so the test would silently skip when run in isolation or out of order — only passing when an earlier test had already loaded the dataset into the environment.

Change

  • tests/testthat/test-kinship2_aligns.R: Moved data("ASOIAF") to before the exists()/nrow() guard in the "classic option passes through kinship2_alignped stages with ASOIAF" test, matching the pattern already used by all other ASOIAF tests in the same file.

Before:

test_that("classic option passes through kinship2_alignped stages with ASOIAF", {
  skip_if_not_installed("quadprog")
  # skip if not the correct data version
  if (!exists("ASOIAF") || !is.data.frame(ASOIAF) || nrow(ASOIAF) != asoiaf_nrow) {
    skip("ASOIAF data not available, or not the correct version")
  }
  data("ASOIAF")  # too late — check already ran
  ...

After:

test_that("classic option passes through kinship2_alignped stages with ASOIAF", {
  skip_if_not_installed("quadprog")
  data("ASOIAF")
  # skip if not the correct data version
  if (!exists("ASOIAF") || !is.data.frame(ASOIAF) || nrow(ASOIAF) != asoiaf_nrow) {
    skip("ASOIAF data not available, or not the correct version")
  }
  ...

Copilot AI changed the title [WIP] Fix code as per review comment 3660917598 Fix order-dependent ASOIAF test skipping data() load before exists() check Jul 27, 2026
Copilot AI requested a review from smasongarrison July 27, 2026 21:13
Fix order-dependent ASOIAF test: move data() call before exists() check
@smasongarrison
smasongarrison force-pushed the copilot/fix-review-comment-3660917598 branch from 2aeb66b to c402f2b Compare July 27, 2026 21:24
@smasongarrison
smasongarrison marked this pull request as ready for review July 27, 2026 21:25
@smasongarrison
smasongarrison merged commit 38b48e0 into dev Jul 27, 2026
6 checks passed
@smasongarrison
smasongarrison deleted the copilot/fix-review-comment-3660917598 branch July 27, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants