Skip to content

Commit

Permalink
test time only on laptop, not on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
pachadotdev committed Aug 8, 2024
1 parent 98e84ab commit 674595d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
10 changes: 1 addition & 9 deletions tests/testthat/test-errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,7 @@ test_that("error conditions", {
trade ~ log_dist | rta,
data = list()
),
"'data' has to be of class data.frame"
)

expect_error(
fepoisson(
trade ~ log_dist | rta,
data = list()
),
"'data' has to be of class data.frame"
"length zero"
)

expect_error(
Expand Down
50 changes: 26 additions & 24 deletions tests/testthat/test-fepoisson.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,32 @@ test_that("fepoisson is similar to fixest", {
# unique(trade_panel$year)
trade_panel_2006 <- trade_panel[trade_panel$year == 2006, ]

t_fepoisson <- rep(0,10)
for (i in 1:10) {
t1 <- Sys.time()
fit <- fepoisson(
trade ~ log_dist + lang + cntg + clny | exp_year + imp_year,
trade_panel_2006
)
t2 <- Sys.time()
t_fepoisson <- t2 - t1
}
t_fepoisson <- median(t_fepoisson)
if (identical(Sys.info()[['user']], 'pacha')) {
t_fepoisson <- rep(0,10)
for (i in 1:10) {
t1 <- Sys.time()
fit <- fepoisson(
trade ~ log_dist + lang + cntg + clny | exp_year + imp_year,
trade_panel_2006
)
t2 <- Sys.time()
t_fepoisson <- t2 - t1
}
t_fepoisson <- median(t_fepoisson)

t_glm <- rep(0,10)
for (i in 1:0) {
t1 <- Sys.time()
fit <- suppressWarnings(glm(
trade ~ log_dist + lang + cntg + clny + as.factor(exp_year) + as.factor(imp_year),
trade_panel_2006,
family = poisson(link = "log")
))
t2 <- Sys.time()
t_glm <- t2 - t1
}
t_glm <- median(t_glm)
t_glm <- rep(0,10)
for (i in 1:0) {
t1 <- Sys.time()
fit <- suppressWarnings(glm(
trade ~ log_dist + lang + cntg + clny + as.factor(exp_year) + as.factor(imp_year),
trade_panel_2006,
family = poisson(link = "log")
))
t2 <- Sys.time()
t_glm <- t2 - t1
}
t_glm <- median(t_glm)

expect_lte(t_fepoisson, t_glm)
expect_lte(t_fepoisson, t_glm)
}
})

0 comments on commit 674595d

Please sign in to comment.