From 00c294f0505bdf395e5885837191cba28acc80aa Mon Sep 17 00:00:00 2001 From: Carl Suster Date: Wed, 10 Jan 2024 09:27:23 +1100 Subject: [PATCH] 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. --- tests/testthat/test-show-news.R | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-show-news.R b/tests/testthat/test-show-news.R index 704c9fd1a..4aa504d50 100644 --- a/tests/testthat/test-show-news.R +++ b/tests/testthat/test-show-news.R @@ -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)) }) @@ -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)) })