test_jsonify is failing from an extra space?

32 views
Skip to first unread message

Jacob Case

unread,
Feb 17, 2015, 11:43:54 PM2/17/15
to ansible...@googlegroups.com
Hello, first post here!

I'm trying to run the tests, but I'm getting the following error.

======================================================================
FAIL: test_jsonify (TestUtils.TestUtils)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jacob/ansible-dev/ansible/test/units/TestUtils.py", line 186, in test_jsonify
    self.assertEqual(ansible.utils.jsonify(dict(foo='bar', baz=['qux']), format=True), expected)
AssertionError: u'{\n    "baz": [\n        "qux"\n    ], \n    "foo": "bar"\n}' != u'{\n    "baz": [\n        "qux"\n    ],\n    "foo": "bar"\n}'
  {
      "baz": [
          "qux"
-     ], 
?       -
+     ],
      "foo": "bar"
  }
    """Fail immediately, with the given message."""
>>  raise self.failureException(u'u\'{\\n    "baz": [\\n        "qux"\\n    ], \\n    "foo": "bar"\\n}\' != u\'{\\n    "baz": [\\n        "qux"\\n    ],\\n    "foo": "bar"\\n}\'\n  {\n      "baz": [\n          "qux"\n-     ], \n?       -\n+     ],\n      "foo": "bar"\n  }')
    

----------------------------------------------------------------------
Ran 230 tests in 8.206s

FAILED (failures=1)
make: *** [tests] Error 1
(ansible-dev)➜  ansible git:(devel) python --version
Python 2.7.6


The issue looks like the expected output doesn't have a space right before the newline before "foo", but the test result does have a space there. Is this a bug?

My interpreter is Python 2.7.6 (also provided in code snippet), in a virtual environment, and the environment setup in hacking has been sourced,
Also, before running the tests, here is the output of pip at the end:

Successfully installed paramiko PyYAML jinja2 httplib2 passlib nose mock pycrypto ecdsa markupsafe

I believe that's all the packages I should need.

In case it matters, I'm on Mint 17.

Thank you for any help.

Matt Martz

unread,
Feb 18, 2015, 9:15:00 AM2/18/15
to ansible...@googlegroups.com
I believe this was already fixed in https://github.com/ansible/ansible/commit/bc5d0a8cd499ffb57598b02e38c31c499236d691
--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/9ce0868d-52a9-4798-8ea1-65b9fc0cb511%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Matt Martz
@sivel
sivel.net

Jacob Case

unread,
Feb 18, 2015, 11:30:45 AM2/18/15
to ansible...@googlegroups.com
Hi, thank you for the quick reply.

It seems that commit has broken the test for me.  In that commit, the space is removed that allows the test to pass if it's present.  To test this, I did the following.
Performed the test like I did originally, it failed the jsonify test.
Performed the test after checking out the commit right before the one that you linked to, it passed the test and all others.

I repeated those in a fresh ubuntu/trusty64 Vagrant VM, with only the bare requirements installed (pip, python-dev, git), then set up the environment again. There I had the same results as I got above: It fails with the latest, it passes before the commit.

What should I do to get the test to pass?

Thank you,

-Jacob Case
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Brian Coca

unread,
Feb 18, 2015, 12:33:53 PM2/18/15
to ansible...@googlegroups.com
Our internal jenkins seems to disagree with everyone, I've submitted
another PR that should fix this fot all cases

--
Brian Coca

Dan

unread,
Mar 19, 2015, 9:58:41 AM3/19/15
to ansible...@googlegroups.com
I can't get test_jsonify to pass with a pristine 1.8.4 release. It would be nice to fix the 1.8.4 git release so that the tests actually pass.
Reply all
Reply to author
Forward
0 new messages