File: test_skip_pyquante.patch

package info (click to toggle)
cclib 1.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,412 kB
  • sloc: python: 23,605; makefile: 75; sh: 31
file content (152 lines) | stat: -rw-r--r-- 5,462 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
Index: cclib/test/method/testbader.py
===================================================================
--- cclib.orig/test/method/testbader.py	2025-12-12 15:00:22.557581906 +0100
+++ cclib/test/method/testbader.py	2025-12-12 18:49:05.912898536 +0100
@@ -11,6 +11,7 @@
 from cclib.method import Bader, volume
 from cclib.method.calculationmethod import MissingAttributeError
 from cclib.parser import Psi4
+from cclib.parser.utils import find_package
 
 import numpy
 import pytest
@@ -18,6 +19,7 @@
 
 from ..test_data import getdatafile
 
+_found_pyquante = find_package("PyQuante")
 
 class BaderTest:
     """Bader's QTAIM method tests."""
@@ -44,6 +46,8 @@
         self.data, logfile = getdatafile(Psi4, "basicPsi4-1.2.1", ["water_mp2.out"])
         self.volume = volume.Volume((-4, -4, -4), (4, 4, 4), (0.2, 0.2, 0.2))
         self.analysis = Bader(self.data, self.volume)
+        if not _found_pyquante:
+            pytest.skip("analysis.calculate() requires PyQuante")
         self.analysis.calculate()
 
         refData = [6.9378, 0.3639, 0.3827]  # values from `bader` package
@@ -57,6 +61,8 @@
         data = ccread(hfpath)
         vol = volume.Volume((-6, -6, -6), (6, 6, 6), (0.2, 0.2, 0.2))
         analysis = Bader(data, vol)
+        if not _found_pyquante:
+            pytest.skip("analysis.calculate() requires PyQuante")
         analysis.calculate()
 
         assert abs(numpy.sum(analysis.fragcharges) - 10) < 1
Index: cclib/test/method/testddec.py
===================================================================
--- cclib.orig/test/method/testddec.py	2025-12-12 15:00:22.557581906 +0100
+++ cclib/test/method/testddec.py	2025-12-12 18:50:47.723494238 +0100
@@ -13,6 +13,7 @@
 from cclib.method import DDEC6, volume
 from cclib.method.calculationmethod import MissingAttributeError
 from cclib.parser import Psi4
+from cclib.parser.utils import find_package
 
 import numpy
 import pytest
@@ -20,6 +21,7 @@
 
 from ..test_data import getdatafile
 
+_found_pyquante = find_package("PyQuante")
 
 class DDEC6Test:
     """DDEC6 method tests."""
@@ -101,6 +103,8 @@
         )
 
         analysis = DDEC6(self.data, imported_vol, os.path.dirname(os.path.realpath(__file__)))
+        if not _found_pyquante:
+            pytest.skip("analysis.calculate() requires PyQuante")
         analysis.calculate()
 
         radial_indices = []
@@ -216,6 +220,8 @@
             os.path.join(os.path.dirname(os.path.realpath(__file__)), "nh3.cube")
         )
         analysis = DDEC6(self.data, imported_vol, os.path.dirname(os.path.realpath(__file__)))
+        if not _found_pyquante:
+            pytest.skip("analysis.calculate() requires PyQuante")
         analysis.calculate()
 
         assert_allclose(
Index: cclib/test/method/testhirshfeld.py
===================================================================
--- cclib.orig/test/method/testhirshfeld.py	2025-12-12 15:00:22.557581906 +0100
+++ cclib/test/method/testhirshfeld.py	2025-12-12 18:52:07.196459421 +0100
@@ -11,6 +11,7 @@
 from cclib.method import Hirshfeld, volume
 from cclib.method.calculationmethod import MissingAttributeError
 from cclib.parser import Psi4
+from cclib.parser.utils import find_package
 
 import numpy
 import pytest
@@ -18,6 +19,7 @@
 
 from ..test_data import getdatafile
 
+_found_pyquante = find_package("PyQuante")
 
 class HirshfeldTest:
     """Hirshfeld method tests."""
@@ -108,6 +110,8 @@
         data = ccread(h2path)
         vol = volume.Volume((-3, -3, -3), (3, 3, 3), (0.1, 0.1, 0.1))
         analysis = Hirshfeld(data, vol, os.path.dirname(os.path.realpath(__file__)))
+        if not _found_pyquante:
+            pytest.skip("analysis.calculate() requires PyQuante")
         analysis.calculate()
 
         assert abs(numpy.sum(analysis.fragcharges) - 0) < 1e-2
Index: cclib/test/method/testvolume.py
===================================================================
--- cclib.orig/test/method/testvolume.py	2025-12-12 15:00:22.561581942 +0100
+++ cclib/test/method/testvolume.py	2025-12-12 18:56:20.239067293 +0100
@@ -10,8 +10,10 @@
 
 from cclib.method import volume
 from cclib.parser import Gaussian, Psi4
+from cclib.parser.utils import find_package
 
 import numpy
+import pytest
 
 sys.path.insert(1, "..")
 
@@ -19,6 +21,7 @@
 
 from ..test_data import getdatafile
 
+_found_pyquante = find_package("PyQuante")
 
 class VolumeTest:
     def test_scinotation(self):
@@ -45,6 +48,7 @@
         assert abs(integral_square - 1.00) < 1e-2  # true for all wavefns
         print(integral, integral_square)
 
+    @pytest.mark.skipif(not _found_pyquante, reason="requires PyQuante")
     def test_density(self):
         """Does the volume occupied by the combined electron density integrate
         to the correct value?
@@ -62,6 +66,7 @@
         assert abs(integral - 8.00) < 1e-2
         print("Combined Density of 4 Frontier orbitals=", integral)
 
+    @pytest.mark.skipif(not _found_pyquante, reason="requires PyQuante")
     def test_cube(self):
         """Does the cube file written out for electron density on a Cartesian grid match
         expected values?
@@ -90,6 +95,7 @@
 
         assert_allclose(density.data, refcube, atol=0.5, rtol=0.1)
 
+    @pytest.mark.skipif(not _found_pyquante, reason="requires PyQuante")
     def test_roundtrip_cube(self):
         """Write a cube file and then read it back. Check if the volume object contains
         identical information on each grid point"""