Skip to content
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

'py.test' and 'make test' don't return the same result #44

Open
Libisch opened this issue Jul 11, 2017 · 1 comment
Open

'py.test' and 'make test' don't return the same result #44

Libisch opened this issue Jul 11, 2017 · 1 comment

Comments

@Libisch
Copy link
Contributor

Libisch commented Jul 11, 2017

When running tests, make test fails, while py.test tests/... passes.

Reproduce:
in clearmash/api.py:

  • add
    def get_document_related_docs_by_fields(self, entity_id, field, max_nesting_depth=1):
        return self._wcm_api_call("/Document/ByRelationField", {"EntityId": entity_id, "FieldId": field, "MaxNestingDepth": max_nesting_depth})

in tests/test_clearmash_api.py:

  • add
def test_get_related_docs_of_item():
    fields = ['_c6_beit_hatfutsot_bh_base_template_family_name',
            '_c6_beit_hatfutsot_bh_base_template_multimedia_movies',
            '_c6_beit_hatfutsot_bh_base_template_multimedia_music',
            '_c6_beit_hatfutsot_bh_base_template_multimedia_photos',
            '_c6_beit_hatfutsot_bh_base_template_related_exhibition',
            '_c6_beit_hatfutsot_bh_base_template_related_musictext',
            '_c6_beit_hatfutsot_bh_base_template_related_personality',
            '_c6_beit_hatfutsot_bh_base_template_related_place',
            '_c6_beit_hatfutsot_bh_base_template_related_recieve_unit',
            '_c6_beit_hatfutsot_bh_base_template_source',
            '_c6_beit_hatfutsot_bh_place_located_in',
            '_c6_beit_hatfutsot_bh_place_locations',
            '_c6_beit_hatfutsot_bh_place_personality_birth',
            '_c6_beit_hatfutsot_bh_place_personality_death']
    related = [MockClearmashApi().get_document_related_docs_by_fields(220590, field) for field in fields]
    assert len(related) == 14
  1. Run $ py.test tests/test_clearmash_api.py -k test_get_related_docs_of_item
    Expected:
    1 passed
    Actual:
    1 passed
(ENV) Libis-MacBook-Pro:mojp-dbs-pipelines libi$ py.test tests/test_clearmash_api.py -k test_get_related_docs_of_item
================================================= test session starts ==================================================
platform darwin -- Python 3.6.1, pytest-3.1.3, py-1.4.34, pluggy-0.4.0
rootdir: /Users/libi/mojp-dbs-pipelines, inifile: tox.ini
plugins: celery-4.0.2
collected 6 items 

tests/test_clearmash_api.py .

================================================== 5 tests deselected ==================================================
======================================== 1 passed, 5 deselected in 0.37 seconds ========================================
  1. Run $ make install and then $ make test
    Expected:
    16 passed
    Actual:
    1 failed (test_get_related_docs_of_item)
======================================================= FAILURES =======================================================
____________________________________________ test_get_related_docs_of_item _____________________________________________

    def test_get_related_docs_of_item():
        fields = ['_c6_beit_hatfutsot_bh_base_template_family_name',
                '_c6_beit_hatfutsot_bh_base_template_multimedia_movies',
                '_c6_beit_hatfutsot_bh_base_template_multimedia_music',
                '_c6_beit_hatfutsot_bh_base_template_multimedia_photos',
                '_c6_beit_hatfutsot_bh_base_template_related_exhibition',
                '_c6_beit_hatfutsot_bh_base_template_related_musictext',
                '_c6_beit_hatfutsot_bh_base_template_related_personality',
                '_c6_beit_hatfutsot_bh_base_template_related_place',
                '_c6_beit_hatfutsot_bh_base_template_related_recieve_unit',
                '_c6_beit_hatfutsot_bh_base_template_source',
                '_c6_beit_hatfutsot_bh_place_located_in',
                '_c6_beit_hatfutsot_bh_place_locations',
                '_c6_beit_hatfutsot_bh_place_personality_birth',
                '_c6_beit_hatfutsot_bh_place_personality_death']
>       related = [MockClearmashApi().get_document_related_docs_by_fields(220590, field) for field in fields]

tests/test_clearmash_api.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_clearmash_api.py:174: in <listcomp>
    related = [MockClearmashApi().get_document_related_docs_by_fields(220590, field) for field in fields]
datapackage_pipelines_mojp/clearmash/api.py:75: in get_document_related_docs_by_fields
    return self._wcm_api_call("/Document/ByRelationField", {"EntityId": entity_id, "FieldId": field, "MaxNestingDepth": max_nesting_depth})
datapackage_pipelines_mojp/clearmash/api.py:80: in _wcm_api_call
    post_data=post_data)
tests/test_clearmash_api.py:53: in _get_request_json
    res = self._get_mock_url_request_json(filename, get_res)
tests/test_clearmash_api.py:25: in _get_mock_url_request_json
    return json.load(f)
/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py:296: in load
    return loads(fp.read(),
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <encodings.ascii.IncrementalDecoder object at 0x1060e0828>
input = b'{\n\t"Entities": [\n\t\t{\n\t\t\t"Acl": "None",\n\t\t\t"Changeset": 4793755,\n\t\t\t"Document": {\n\t\t\t\t"Fields_B...\xd7\x99\xd7\x95\xd7\xa7\xd7\x9f, \xd7\xa4\xd7\x95\xd7\xa8\xd7\x98\xd7\xa8\xd7\x98"\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t]\n}'
final = True

    def decode(self, input, final=False):
>       return codecs.ascii_decode(input, self.errors)[0]
E       UnicodeDecodeError: 'ascii' codec can't decode byte 0xd7 in position 10417: ordinal not in range(128)

.tox/python/lib/python3.6/encodings/ascii.py:26: UnicodeDecodeError
========================================= 1 failed, 15 passed in 2.54 seconds ==========================================
ERROR: InvocationError: '/Users/libi/mojp-dbs-pipelines/.tox/python/bin/py.test -s'
_______________________________________________________ summary ________________________________________________________
ERROR:   python: commands failed
make: *** [test] Error 1
@Libisch
Copy link
Contributor Author

Libisch commented Jul 11, 2017

@OriHoch

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

No branches or pull requests

1 participant