Skip to content

Commit 00c294f

Browse files
committed
Avoid usethis::use_news_md() in test
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.
1 parent 2a5b553 commit 00c294f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/testthat/test-show-news.R

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ test_that("can read NEWS.md in root directory", {
22
skip_on_cran()
33

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

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

1518
dir_create(pkg, "inst")
16-
write("\\name{NEWS}
19+
write(
20+
"\\name{NEWS}
1721
\\title{News for Package 'test'}
1822
1923
\\section{CHANGES IN test VERSION 0.0.1}{
2024
\\itemize{
2125
\\item First version
2226
}
23-
}", path(pkg, "inst", "NEWS.Rd"))
27+
}",
28+
path(pkg, "inst", "NEWS.Rd")
29+
)
2430

2531
expect_no_error(show_news(pkg))
2632
})

0 commit comments

Comments
 (0)