@@ -127,58 +127,3 @@ test_that ("collate all models", {
127
127
model_fns <- get_cm_fns (" model" )
128
128
expect_named (models_all , c (" date" , gsub (" cm\\ _model\\ _" , " " , model_fns )))
129
129
})
130
-
131
- test_that (" collate across orgs" , {
132
-
133
- Sys.setenv (" REPOMETRICS_TESTS" = " true" )
134
- dat <- mock_rm_data ()
135
- path <- generate_test_pkg ()
136
-
137
- # Then mock one set of org data:
138
- metrics_all <- withr :: with_options (
139
- list (" repometrics_period" = 365.25 / 2 ),
140
- metrics_over_end_dates (path , end_date = end_date , num_years = 1 )
141
- )
142
- models_all <- withr :: with_options (
143
- list (" repometrics_period" = 365.25 / 2 ),
144
- models_over_end_dates (path , end_date = end_date , num_years = 1 )
145
- )
146
- dat <- list (
147
- repo = repometrics_data_repo (path , num_cores = 1L ),
148
- metrics = metrics_all ,
149
- models = models_all
150
- )
151
-
152
- org_dir <- fs :: path (fs :: path_temp (), " org" )
153
- if (! fs :: dir_exists (org_dir )) {
154
- fs :: dir_create (org_dir )
155
- }
156
- path1 <- fs :: dir_copy (path , fs :: path (org_dir , " testpkg1" ))
157
- path2 <- fs :: dir_copy (path , fs :: path (org_dir , " testpkg2" ))
158
- fs :: dir_delete (path )
159
-
160
- d1 <- desc :: desc_set (" Package" = " testpkg1" , file = path1 )
161
- d2 <- desc :: desc_set (" Package" = " testpkg2" , file = path2 )
162
-
163
- saveRDS (dat , fs :: path (fs :: path_temp (), " testpkg1.Rds" ))
164
- saveRDS (dat , fs :: path (fs :: path_temp (), " testpkg2.Rds" ))
165
-
166
- # Then the main call, which loads those pre-saved data rather than
167
- # re-generating:
168
- org_data <- repometrics_collate_org_data (
169
- org_dir ,
170
- end_date = end_date ,
171
- num_years = 1
172
- )
173
-
174
- fs :: dir_delete (c (path1 , path2 ))
175
-
176
- expect_type (org_data , " list" )
177
- expect_named (org_data , c (" repos" , " metrics" , " models" ))
178
- npkgs <- 2L
179
- expect_length (org_data $ repos , npkgs )
180
- expect_length (org_data $ metrics , npkgs )
181
- expect_s3_class (org_data $ models , " data.frame" )
182
- n_periods <- length (get_end_date_seq (end_date = end_date , num_years = 1 ))
183
- expect_equal (nrow (org_data $ models ), n_periods )
184
- })
0 commit comments