From 0056584e5168df75bca159ddf3469aa07457b77d Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 19 Nov 2021 00:18:22 +0100 Subject: Update tests and logs --- ChangeLog | 27 +++++++++++++++++++++++++++ DESCRIPTION | 2 +- R/zzz.R | 12 ++++-------- test.log | 17 ++++++++--------- tests/testthat/test_chent.R | 2 +- tests/testthat/test_pai.R | 8 ++++---- 6 files changed, 45 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 69b201d..5daebcf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +commit d032fb8ba7b0827bb896b6d9a07d6449d88cf511 +Author: Johannes Ranke +Date: 2021-11-18 23:52:32 +0100 + + We are on Xenial, no python3-rdkit... + +commit 368edcfe670c674391d79a27a5d0490fbc1a7ef2 +Author: Johannes Ranke +Date: 2021-11-18 23:48:41 +0100 + + Another attempt to get python3-rdkit on Travis + +commit f91a75460fbf756e27bd280b969284d043c5a451 +Author: Johannes Ranke +Date: 2021-11-18 23:22:32 +0100 + + Install python3-rdkit on Travis + +commit ae755fbb06c3dda0740e9bb9323fbdfe3f2788a4 +Author: Johannes Ranke +Date: 2021-11-18 23:03:16 +0100 + + Use reticulate instead of PythonInR, alanwood has moved + + Because the pesticide compendium at alanwood.net has moved to bcpc.org, + we need to depend on a development branch of webchem at the moment. + commit 898d598bcbb022ac767e0105e868798130f2c74c Author: Johannes Ranke Date: 2020-10-13 15:10:03 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 041999c..5793f4b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: chents Type: Package Title: Chemical Entities as R Objects Version: 0.3.1 -Date: 2021-11-18 +Date: 2021-11-19 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de")) Description: Utilities for dealing with chemical entities and associated diff --git a/R/zzz.R b/R/zzz.R index 19ca10d..5503a4a 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -1,13 +1,9 @@ .onLoad = function(libname, pkgname) { rdkit_available <- FALSE - if(requireNamespace("reticulate", quietly = TRUE)) { - rdkit_module <- try(reticulate::import("rdkit")) - if (!inherits(rdkit_module, "try-error")) { - rdkit_available <- TRUE - } + rdkit_module <- try(reticulate::import("rdkit"), silent = TRUE) + if (!inherits(rdkit_module, "try-error")) { + rdkit_available <- TRUE } assign('rdkit_available', rdkit_available, envir = topenv()) - if (rdkit_available) { - assign('rdkit_module', rdkit_module, envir = topenv()) - } + assign('rdkit_module', rdkit_module, envir = topenv()) } diff --git a/test.log b/test.log index 34cf63b..9817e02 100644 --- a/test.log +++ b/test.log @@ -1,12 +1,11 @@ Loading required package: usethis -Loading chents +ℹ Loading chents +ℹ Testing chents +✔ | F W S OK | Context +✔ | 6 | Generation of chent objects [3.3s] +✔ | 8 | Generation of pai objects [8.1s] -Attaching package: ‘testthat’ +══ Results ═════════════════════════════════════════════════════════════════════ +Duration: 11.4 s -The following object is masked from ‘package:devtools’: - - test_file - -Testing chents -✔ | OK F W S | Context - ⠏ | 0 | Generation of chent objects ⠋ | 1 | Generation of chent objects \ No newline at end of file +[ FAIL 0 | WARN 0 | SKIP 0 | PASS 14 ] diff --git a/tests/testthat/test_chent.R b/tests/testthat/test_chent.R index 094ff8b..4551cf7 100644 --- a/tests/testthat/test_chent.R +++ b/tests/testthat/test_chent.R @@ -2,7 +2,7 @@ context("Generation of chent objects") # Check if we can use RDKit skip_if_no_rdkit <- function() { - if (!chents:::rdkit_available()) skip("RDKit is not available via PythonInR") + if (!chents:::rdkit_available) skip("RDKit is not available via reticulate") } oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE, chyaml = FALSE) diff --git a/tests/testthat/test_pai.R b/tests/testthat/test_pai.R index 368876e..e22b6ae 100644 --- a/tests/testthat/test_pai.R +++ b/tests/testthat/test_pai.R @@ -8,12 +8,12 @@ test_that("a pai object is correctly generated from an ambiguous name", { glyphosate <- pai$new("glyphosate", chyaml = FALSE) expect_message(pai$new("benzalkonium chloride", chyaml = FALSE), "did not give results") - expect_equivalent(glyphosate$alanwood$cas, "1071-83-6") - expect_equivalent(glyphosate$alanwood$formula, "C3H8NO5P") - expect_equivalent(glyphosate$alanwood$iupac_name, "N-(phosphonomethyl)glycine") + expect_equivalent(glyphosate$bcpc$cas, "1071-83-6") + expect_equivalent(glyphosate$bcpc$formula, "C3H8NO5P") + expect_equivalent(glyphosate$bcpc$iupac_name, "N-(phosphonomethyl)glycine") expect_equal(names(glyphosate$identifier), "glyphosate") ik = "XDDAORKBJWWYJS-UHFFFAOYSA-N" - attr(ik, "source") <- c("alanwood", "pubchem") + attr(ik, "source") <- c("bcpc", "pubchem") expect_equal(glyphosate$inchikey, ik) expect_equivalent(round(glyphosate$mw, 2), 169.07) smiles <- "C(C(=O)O)NCP(=O)(O)O" -- cgit v1.2.1