Skip to content

Commit

Permalink
Avoid usethis::use_news_md() in test
Browse files Browse the repository at this point in the history
It seems that the temporary package created in the test causes
usethis to infer the incorrect project name sometimes which caused
a the test to be flaky.
  • Loading branch information
arcresu committed Jan 9, 2024
1 parent 2a5b553 commit 00c294f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/testthat/test-show-news.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ test_that("can read NEWS.md in root directory", {
skip_on_cran()

pkg <- local_package_create()
suppressMessages(usethis::with_project(pkg, use_news_md()))
write(
"# test (development version)\n\n* Initial CRAN submission.",
path(pkg, "NEWS.md")
)

expect_no_error(show_news(pkg))
})
Expand All @@ -13,14 +16,17 @@ test_that("can read NEWS.Rd in inst directory", {
pkg <- local_package_create()

dir_create(pkg, "inst")
write("\\name{NEWS}
write(
"\\name{NEWS}
\\title{News for Package 'test'}
\\section{CHANGES IN test VERSION 0.0.1}{
\\itemize{
\\item First version
}
}", path(pkg, "inst", "NEWS.Rd"))
}",
path(pkg, "inst", "NEWS.Rd")
)

expect_no_error(show_news(pkg))
})
Expand Down

0 comments on commit 00c294f

Please sign in to comment.