dataverse-client-python icon indicating copy to clipboard operation
dataverse-client-python copied to clipboard

test_dataverse.py produces warning/error messages.

Open markrlondon opened this issue 8 years ago • 2 comments

Can you upgrade test_dataverse.py so that it doesn't produce the following error? Thanks.

t# py.test test_dataverse.py::TestConnection::test_connect ============================= test session starts ============================== platform linux2 -- Python 2.7.6 -- pytest-2.5.1 collected 8 items

test_dataverse.py .E

==================================== ERRORS ==================================== _______________ ERROR at teardown of TestConnection.test_connect _______________

cls = <class 'dataverse.test.test_dataverse.TestConnection'>

@classmethod
def teardown_class(cls):
    """Delete the temporary user.

        Note that this will fail if the user has any non-deleted content.
        """
    delete_url = 'https://{0}/api/admin/authenticatedUsers/{1}/'.format(
        TEST_HOST, cls.username,
    )
    resp = requests.delete(delete_url)
  assert resp.status_code == 200

E assert 503 == 200 E + where 503 = <Response [503]>.status_code

test_dataverse.py:55: AssertionError ------------------------------- Captured stderr -------------------------------- /usr/local/lib/python2.7/dist-packages/src/dataverselj/dataverse/test/test_dataverse.py:113: FutureWarning: The behavior of this method will change in future versions. Use specific 'len(elem)' or 'elem is not None' test instead. assert connection._service_document ====================== 1 passed, 1 error in 1.16 seconds ======================= root@report:/usr/local/lib/python2.7/dist-packages/src/dataverselj/dataverse/test#

markrlondon avatar Jun 06 '17 20:06 markrlondon

@markrlondon thanks for the bug report! Does this seem to be the same issue as #32?

pdurbin avatar Jun 07 '17 12:06 pdurbin

This is a different problem. There has been a warning in XML parsing code that a behavior is someday going to change, and that you have to update your code. See the following link. Strangely, according to that page, the warning has been there for 7+ years, and it's never actually been implemented.

https://stackoverflow.com/questions/18583162/difference-between-if-obj-and-if-obj-is-not-none

markrlondon avatar Jun 07 '17 20:06 markrlondon