Skip to content

Commit

Permalink
Boost testing requirements, remove unnecessary imports
Browse files Browse the repository at this point in the history
  • Loading branch information
kroenlein committed Feb 2, 2024
1 parent 2a36a04 commit 9aab314
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 89 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ python:
env:
- UPGRADES="-U --only-binary 'pint,pandas' pint pandas"
- UPGRADES=""
jobs:
exclude:
- python: '3.12'
env: UPGRADES=""
install:
- pip install --only-binary ':all:' -r requirements.txt
- test $TRAVIS_PYTHON_VERSION != "3.12" || perl -pi -E 's/^.*(?:pandas|flake8-docstrings).*$//' test_requirements.txt
- pip install --only-binary ':all:' -r test_requirements.txt
- pip install $UPGRADES -e .
script:
Expand Down
3 changes: 3 additions & 0 deletions doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx==5.0.0
sphinx-rtd-theme==1.0.0
sphinxcontrib-apidoc==0.3.0
2 changes: 1 addition & 1 deletion gemd/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.18.2"
__version__ = "1.18.4"
1 change: 1 addition & 0 deletions scripts/build_docs.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pip install -r doc_requirements.txt
cd docs
make html
touch _build/html/.nojekyll
59 changes: 0 additions & 59 deletions scripts/validate-version-bump.sh

This file was deleted.

7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
],
extras_require={
"tests": [
"pytest>=7.3.1,<8"
"pytest>=8.0.0,<9"
],
"tests.demo": [
"pandas>=1.3.5,<3"
"pandas>=2.0.3,<3"
],
"tests.entity.bounds": [
"numpy"
"numpy>=1.24.4,<2",
"pandas>=2.0.3,<3"
]
},
classifiers=[
Expand Down
12 changes: 4 additions & 8 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
flake8==6.1.0
flake8==7.0.0
flake8-docstrings==1.7.0
pytest==7.3.1
pytest-cov==4.0.0
pandas==1.5.0
toolz==0.12.0
pytest==8.0.0
pytest-cov==4.1.0
pandas>=2.0.3,<2.2.0
derp==0.1.1
sphinx==5.0.0
sphinx-rtd-theme==1.0.0
sphinxcontrib-apidoc==0.3.0
2 changes: 1 addition & 1 deletion tests/entity/bounds/test_categorical_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_numpy():
np_copy = loads(dumps(np_bounds))
assert np_copy == np_bounds

if len(array_like()) > 3: # Test numpy
if len(array_like()) > 3: # Test pandas
import pandas as pd
pd_bounds = CategoricalBounds(pd.Series(["spam", "eggs"]))
pd_copy = loads(dumps(pd_bounds))
Expand Down
19 changes: 7 additions & 12 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
"""Test of a complicated set of interlocking data objects."""
import json

from gemd.entity.object.ingredient_run import IngredientRun
from toolz import keymap, merge, keyfilter

from gemd.json import dumps
from gemd.entity.attribute.condition import Condition
from gemd.entity.attribute.parameter import Parameter
from gemd.entity.attribute.property import Property
from gemd.entity.bounds.real_bounds import RealBounds
from gemd.entity.object import MeasurementRun, MaterialRun, ProcessRun, ProcessSpec,\
MeasurementSpec, MaterialSpec
MeasurementSpec, MaterialSpec, IngredientRun
from gemd.entity.template.condition_template import ConditionTemplate
from gemd.entity.template.material_template import MaterialTemplate
from gemd.entity.template.measurement_template import MeasurementTemplate
Expand Down Expand Up @@ -45,13 +42,13 @@

def make_data_island(density, bulk_modulus, firing_temperature, binders, powders, tag=None):
"""Helper function to create a relatively involved data island."""
binder_specs = keymap(lambda x: MaterialSpec(name=x), binders)
powder_specs = keymap(lambda x: MaterialSpec(name=x), powders)
binder_specs = {MaterialSpec(name=k): v for k, v in binders.items()}
powder_specs = {MaterialSpec(name=k): v for k, v in powders.items()}

binder_runs = keymap(lambda x: MaterialRun(name=x.name, spec=x), binder_specs)
powder_runs = keymap(lambda x: MaterialRun(name=x.name, spec=x), powder_specs)
binder_runs = {MaterialRun(name=k.name, spec=k): v for k, v in binder_specs.items()}
powder_runs = {MaterialRun(name=k.name, spec=k): v for k, v in powder_specs.items()}

all_input_materials = keymap(lambda x: x.spec.name, merge(binder_runs, powder_runs))
all_input_materials = {k.spec.name: v for k, v in binder_runs.items() | powder_runs.items()}
mixing_composition = Condition(
name="composition",
value=NominalComposition(all_input_materials)
Expand Down Expand Up @@ -161,9 +158,7 @@ def test_access_data():

# read the quantity of alumina
quantities = island.process.ingredients[0].material.process.conditions[0].value.quantities
assert(list(
keyfilter(lambda x: x == "Al2O3", quantities).values()
)[0] == 0.96)
assert quantities.get("Al2O3") == 0.96

# check that the serialization results in the correct number of objects in the preface
# (note that neither measurements nor ingredients are serialized)
Expand Down

0 comments on commit 9aab314

Please sign in to comment.