Skip to content

Get tests passing #22

@jpmckinney

Description

@jpmckinney

CI started failing on main when this commit was pushed: 3b80bd6

============================= test session starts ==============================
platform linux -- Python 3.12.10, pytest-8.4.1, pluggy-1.6.0
rootdir: /home/runner/work/nightingale/nightingale
configfile: pyproject.toml
plugins: mock-3.14.1
collected 47 items

nightingale/mapper.py .                                                  [  2%]
nightingale/utils.py .                                                   [  4%]
tests/test_cli.py ......                                                 [ 17%]
tests/test_codelists.py ....                                             [ 25%]
tests/test_loader.py ..                                                  [ 29%]
tests/test_mapping_loader.py ..........                                  [ 51%]
tests/test_publisher.py .                                                [ 53%]
tests/test_unflatten.py .............F.                                  [ 85%]
tests/test_validator.py ....                                             [ 93%]
tests/test_writer.py ...                                                 [100%]

=================================== FAILURES ===================================
_____________________________ test_finish_release ______________________________

mock_config = <MagicMock name='MappingTemplate' id='139920734434944'>
mock_get_iso_now = <MagicMock name='get_iso_now' id='139920734410928'>
base_config = Config(datasource=Datasource(connection='sqlite:///:memory:'), mapping=Mapping(file=PosixPath('/dummy/path.xlsx'), oci...er_scheme='', publisher_uri='', license='', publicationPolicy=''), output=Output(directory=PosixPath('/dummy/output')))

    @mock.patch("nightingale.mapper.get_iso_now")
    @mock.patch("nightingale.mapper.MappingTemplate", return_value=dummy_ocds_mapping_template([], {}))
    def test_finish_release(mock_config, mock_get_iso_now, base_config):
        mock_get_iso_now.return_value = "2022-01-01T00:00:00Z"
        mapper = OCDSDataMapper(base_config)
        curr_release = {"field": "value1", "tender": {"id": 1}}
        curr_ocid = "1"
        mapped = []
        mapper.finish_release(curr_ocid, curr_release, mapped, None)
        expected_release = {
            "field": "value1",
            "initiationType": "tender",
            "date": "2022-01-01T00:00:00Z",
            "ocid": "prefix-1",
            "tag": ["tender"],
            "tender": {"id": 1},
            "id": generate_hash(
                {
                    "field": "value1",
                    "initiationType": "tender",
                    "date": "2022-01-01T00:00:00Z",
                    "ocid": "prefix-1",
                    "tag": ["tender"],
                    "tender": {"id": 1},
                }
            ),
        }
        assert len(mapped) == 1
>       assert mapped[0] == expected_release
E       AssertionError: assert {'field': 'va...refix-1', ...} == {'date': '202...'tender', ...}
E         
E         Omitting 5 identical items, use -vv to show
E         Differing items:
E         {'id': '65aeda7e9f72ca90072fe5dd3879df888283874d28d41e3c38c2ab3d340ecb19'} != {'id': 'fe3077350976be159403575e8c98368cce679c4d438dafe5b53e0d1a2b7f3c9f'}
E         Right contains 1 more item:
E         {'date': '2022-01-01T00:00:00Z'}
E         
E         Full diff:
E           {
E         -     'date': '2022-01-01T00:00:00Z',
E               'field': 'value1',
E         -     'id': 'fe3077350976be159403575e8c98368cce679c4d438dafe5b53e0d1a2b7f3c9f',
E         +     'id': '65aeda7e9f72ca90072fe5dd3879df888283874d28d41e3c38c2ab3d340ecb19',
E               'initiationType': 'tender',
E               'ocid': 'prefix-1',
E               'tag': [
E                   'tender',
E               ],
E               'tender': {
E                   'id': 1,
E               },
E           }

tests/test_unflatten.py:442: AssertionError
=========================== short test summary info ============================
FAILED tests/test_unflatten.py::test_finish_release - AssertionError: assert {'field': 'va...refix-1', ...} == {'date': '202...'tender', ...}
  
  Omitting 5 identical items, use -vv to show
  Differing items:
  {'id': '65aeda7e9f72ca90072fe5dd3879df888283874d28d41e3c38c2ab3d340ecb19'} != {'id': 'fe3077350976be159403575e8c98368cce679c4d438dafe5b53e0d1a2b7f3c9f'}
  Right contains 1 more item:
  {'date': '2022-01-01T00:00:00Z'}
  
  Full diff:
    {
  -     'date': '2022-01-01T00:00:00Z',
        'field': 'value1',
  -     'id': 'fe3077350976be159403575e8c98368cce679c4d438dafe5b53e0d1a2b7f3c9f',
  +     'id': '65aeda7e9f72ca90072fe5dd3879df888283874d28d41e3c38c2ab3d340ecb19',
        'initiationType': 'tender',
        'ocid': 'prefix-1',
        'tag': [
            'tender',
        ],
        'tender': {
            'id': 1,
        },
    }
========================= 1 failed, 46 passed in 1.55s =========================

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions