Skip to content

patch to pass Python pytest checks (applies only to Linux) #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

nbehrnd
Copy link
Contributor

@nbehrnd nbehrnd commented Apr 11, 2025

Changes on side of the PubChem database and Python's syntax broke some of the checks with pytest defined until April 2017. Except for probing the readout of mmff94_energy_3d now commented out, each of them pass again in GitHub's runner image of Ubuntu 24.04 with Python 3.13.2 and pytest 8.3.5. The additional pyproject.toml file includes a constraining classifier

"Operating System :: POSIX :: Linux",

as a brief reminder about the difficulties to run pubchempy.py in Windows.

nbehrnd added 12 commits April 9, 2025 16:32
With the advent of Python 3.13, this no longer yields only a
syntax warning but is a syntax error (label F632 by flake8,
version 7.1.1).  Edit based on discussion.[1]

[1] mcs07#92

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Matthew Swan left a considerable test bench of Pytest checks.
Coupled to a GitHub action, this could be used to check the
state of the package.  Based on `datawarrior_clustersort`,[1]
the scope is constrained to Linux (GitHub's runner of Ubuntu
24.04) with Python 3.13 because PubChemPy's work in Windows
is known to (currently) present difficulties.[2]

[1] https://github.com/nbehrnd/datawarrior_clustersort
[2] mcs07#89

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
The PubChem database limits the number of queries per unit of
time.  The threshold appears to be lower, than the GitHub
runners normally launch pytest checks which eventually may
yield to a refusal by PubChem's interface, and hence a failure
of a pytest check.  This is now addressed with a throttle
on pytest's side.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Previously, the Python wheel likely was build with bdist and
the `setup.py`.  A build with `python -m build` and organization
with a `pyproject.toml` file can be set up independent to this
as an additional workflow which independent to the former.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
At present, the bioassay of PubChem AID 490 is of status
"revoked".[1]  This contrasts e.g., to AID 1490 of current
status "live".[2]  By edit of the test script, instead of
"1 failure 3 errors" pytest now reports "1 failure 3 passes"
indicative some problems of the automated checks indeed are
due to changes on the side of the database accessed.

[1] https://pubchem.ncbi.nlm.nih.gov/bioassay/490
[2] https://pubchem.ncbi.nlm.nih.gov/bioassay/1490

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Manual tests on pubchem's website reveal AID 3490 is a record
which fits the criterion of "Project Category == Literature,
Extracted" (section 8.4 on the current web site layout).[1]
This edit eventually renders all assertions of the pytest script
`test_assay.py` True.

[1] https://pubchem.ncbi.nlm.nih.gov/bioassay/3490#section=Project-Category

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
As by today CID 150194 is pubchem's record[1] about dichloro-
tetrakis(dimethylsulfoxide)ruthenium II (date of creation
2005-08-01, last modification: 2025-03-29).  Thus the identifier
is removed from function `test_no_identifiers` which in turn
renders all other assertions of pytest `test_identifiers.py`
True.

[1] https://pubchem.ncbi.nlm.nih.gov/compound/150194

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
There are read-outs of data (for instance `molecular_weight`)
from the database which should be processed as floats.  As an
additional safety layer to process them well (includes checks
as defined for instance in file `test_compound.py`), explicit
datatype conversions were added.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Function `mmff94_energy_3d` is commented out because reference
compound 241 (benzene) does not reports this value on its
record page[1] (last revision by 2025-03-29) and it appears
possible pytest fails (equally) for looking up this in vain.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Because the main function doesn't return mmff94_energy_3d`,
the check on this by the test function equally is muted.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Apparently it isn't presence/absence of column values, but the
sequence of these list elements vs the reference which let the
check fail.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
The edits allowing PubChemPy to pass again most of Matthew Swain's
test bank actually are a patch and hence should increment the
version count.  This however acknowledges "working" is constrained
to Linux as operating system.

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
In the setup provided by Matthew Swain, versioning is managed
from one place.  The commit thus establishes again synchronicity,
adds the pyproject.toml file (and extends its information about
the project).

Signed-off-by: Norwid Behrnd <nbehrnd@yahoo.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant