GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Avoid library() in test files by MichaelChirico · Pull Request #741 · IRkernel/IRkernel

Conversation

@MichaelChirico

@MichaelChirico MichaelChirico commented Sep 14, 2023

Copy link
Copy Markdown
Contributor

This makes tests less hermetic by creating permanent side effects that survive the test file.

Also remove deprecated expect_is() in anticipation of upgrading to {testthat} 3rd edition.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@MichaelChirico
Avoid library() in test files
a93b338
@flying-sheep
flying-sheep added this pull request to the merge queue Nov 13, 2023
@flying-sheep

flying-sheep commented Nov 13, 2023

Copy link
Copy Markdown
Member

Thanks!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 13, 2023

Uh oh!

There was an error while loading. Please reload this page.

flying-sheep
flying-sheep requested changes Nov 13, 2023
View reviewed changes
Comment thread tests/testthat/test_utils.r Resolved

Uh oh!

There was an error while loading. Please reload this page.

@MichaelChirico
Update test_utils.r
44c899a
hadley
hadley reviewed Nov 14, 2023
View reviewed changes
Comment thread tests/testthat/test_utils.r
expect_is(skipped_stack[[1]], 'call')
# See discussion in #741 about using inherits() here and not
# expect_type(., "language") or expect_true(is.call(.)) or expect_mode(., "call")
expect_true(inherits(skipped_stack[[1]], 'call'))

@hadley hadley Nov 14, 2023

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could make this test more clear by making it more explicit:

expect_equal(skipped_stack[[1]], quote(f(1)))

Or even:

expect_equal(skipped_stack, list(quote(f(1)), quote(stop(x))))

That illustrates a subtle problem somewhere in the stack because if you print skipped_stack you see:

[[1]]
f(1)

[[2]]
function(x) stop(x)

Because the srcref is out of sync with the actual contents of the element.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@flying-sheep flying-sheep flying-sheep requested changes
+1 more reviewer
@hadley hadley hadley left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@MichaelChirico @flying-sheep @hadley
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.