Skip to content

Commit 0c7ba22

Browse files
authored
Merge pull request #91 from cropsinsilico/minor
Minor
2 parents 29c52d5 + 3d719a9 commit 0c7ba22

53 files changed

Lines changed: 911 additions & 213 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test-install.yml

Lines changed: 126 additions & 107 deletions
Large diffs are not rendered by default.

HISTORY.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,25 @@
22
History
33
=======
44

5-
1.8.2 (2021-XX-XX) Migrate tests out of package & into pytest fixtures
5+
1.8.2 (2021-03-16) Migrate tests out of package into pytest fixtures & various bug fixes
66
------------------
77

88
* Move tests out of package to take advantage of pytest conftest.py structure and reduce the size of the package
99
* Refactor tests to use pytest fixtures instead of the unittest setup/teardown structure
1010
* Remove the yggtest CLI and migrate options into pytest CLI options
11-
* Update the GHA workflow to use the new pytest based CLI
11+
* Updated the GHA workflow to use the new pytest based CLI and test parameters so that changing the image used won't change the name of the test required to merge pull requests
1212
* Use lock to prevent parallel compilation for all compiled languages
1313
* Remove 'initial_state' parameter from Transform and Filter schemas as it is unused
1414
* Remove unused yggdrasil.communication.cleanup_comms method
15+
* Updated requirements (pinned libroadrunner to < 2.0.7 and unpinned pytest)
16+
* Updated tests to allow comparison of class objects imported in different ways
17+
* Updated the connection and comm schemas to allow for inputs & vars to include datatypes, fixing a bug where turning on debugging caused the validation of connection parameters to fail
18+
* Updated the connections to allow the input and output patterns to be passed directly
19+
* Added a method for displaying information about serializers and added that information to comm info displays
20+
* Fixed a bug in updating the serializer from messages for ForkComms with a scatter communication pattern
21+
* Added the split_and_merge example of using communication patterns to split and merge messages between multiple inputs/outputs
22+
* Fixed a bug in pandas serializer where strings are now stored as objects by default
23+
* Fixed a bug in table serializer where table parameters were not being passed to the header discovery function, resulting in them being ignored in some cases
1524

1625
1.8.1 (2021-10-15) Minor updates to support model submission form development
1726
------------------

requirements_optional.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ astropy # [astropy]
22
pika>=1.0.0 # [rmq]
33
pygments # [pygments]
44
trimesh # [trimesh]
5-
libroadrunner # [pip,sbml]
5+
libroadrunner<2.0.7 # [pip,sbml]
66
ccache; platform_system != 'Windows' # [conda]
77
mpi4py # [mpi]

requirements_piponly.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
libroadrunner # [pip,sbml]
1+
libroadrunner<2.0.7 # [pip,sbml]

requirements_testing.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ coverage
33
flake8
44
flaky
55
nose
6-
pytest>=4.6 # Required by pytest-cov, but not resolved by pip on linux
6+
pytest
77
pytest-cov
88
pytest-timeout
9+
pytest-mpi
910
pytest-drop-dup-tests # [pip]
1011
pytest-rerunfailures
1112
pytest-repeat

tests/metaschema/properties/test_ArgsMetaschemaProperty.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,24 @@
44
import weakref
55

66

7-
class Dummy(object): # pragma: debug
7+
class DummyMeta(type): # pragma: debug
8+
9+
def __eq__(self, solf):
10+
import inspect
11+
a_str = f"{self.__module__}.{self.__name__}[{inspect.getfile(self)}]"
12+
b_str = f"{solf.__module__}.{solf.__name__}[{inspect.getfile(solf)}]"
13+
return a_str == b_str
14+
15+
def __hash__(self):
16+
import inspect
17+
return hash(f"{self.__module__}.{self.__name__}[{inspect.getfile(self)}]")
18+
19+
20+
class Dummy(metaclass=DummyMeta): # pragma: debug
821
pass
922

1023

11-
class ValidArgsClass1(object):
24+
class ValidArgsClass1(metaclass=DummyMeta):
1225
test_args = tuple([int(0), Dummy])
1326
test_kwargs = dict(c=int(1), d=Dummy)
1427
valid_args = [{'type': 'int'}, {'type': 'class'}]
@@ -25,7 +38,7 @@ def __init__(self, a, b, c=0, d=Dummy):
2538
self._input_kwargs = {'c': c, 'd': weakref.ref(d)}
2639

2740
def __eq__(self, solf):
28-
if not isinstance(solf, self.__class__): # pragma: debug
41+
if solf.__class__ != self.__class__: # pragma: debug
2942
return False
3043
return ((self._input_args == solf._input_args)
3144
and (self._input_kwargs == solf._input_kwargs))

tests/serialize/test_AsciiTableSerialize.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22
import numpy as np
33
from yggdrasil.serialize import AsciiTableSerialize
4+
from yggdrasil import platform
45
from tests.serialize.test_DefaultSerialize import (
56
TestDefaultSerialize as base_class)
67

@@ -23,6 +24,32 @@ def test_deserialize_nofmt():
2324
inst.deserialize(test_msg)
2425

2526

27+
def test_discover_header_no_header(tmpdir):
28+
r"""Test discover_header with single line, two columns, no header and
29+
non-default delimiter."""
30+
fd0 = tmpdir.join("temp_table.txt")
31+
fd0.write(b"13 berlin", 'wb')
32+
fd = fd0.open('rb')
33+
inst = AsciiTableSerialize.AsciiTableSerialize(delimiter=b' ')
34+
inst.deserialize_file_header(fd)
35+
if platform._is_win: # pragma: windows
36+
assert(inst.format_str == b'%d %6s\n')
37+
else:
38+
assert(inst.format_str == b'%ld %6s\n')
39+
assert(inst.field_names == ('f0', 'f1'))
40+
41+
42+
def test_discover_header_one_element(tmpdir):
43+
r"""Test discover_header with single line, single column, no header."""
44+
fd0 = tmpdir.join("temp_table.txt")
45+
fd0.write(b"berlin", 'wb')
46+
fd = fd0.open('rb')
47+
inst = AsciiTableSerialize.AsciiTableSerialize(delimiter=b' ')
48+
inst.deserialize_file_header(fd)
49+
assert(inst.format_str == b'%6s\n')
50+
assert(inst.field_names == ('f0',))
51+
52+
2653
_options = [
2754
{},
2855
{'explicit_testing_options': {

utils/setup_test_env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ def install_deps(method, return_commands=False, verbose=False,
877877
pip_flags = '--no-dependencies'
878878
if verbose:
879879
pip_flags += ' --verbose'
880-
cmds.append('%s -m pip install %s libroadrunner'
880+
cmds.append('%s -m pip install %s \"libroadrunner<2.0.7\"'
881881
% (python_cmd, pip_flags))
882882
if install_opts['lpy']:
883883
if verbose:

0 commit comments

Comments
 (0)