jdiegodcp / ramlfications

Python parser for RAML
https://ramlfications.readthedocs.org
Apache License 2.0
234 stars 50 forks source link

Python 3.5 support, and Travis improvements #86

Closed PiDelport closed 8 years ago

PiDelport commented 8 years ago

This adds Python 3.5 to the list of tested and supported environments.

econchick commented 8 years ago

I've heard that the mocks don't really work with Python 3.5 (see this conversation) - I've been meaning to look deeper into this, I can't remember what the issue is exactly. And I'll be frank - mocking is still a bit of a mystery to me, I could have just been mocking incorrectly this whole time. I did find it difficult to have mocks for both with and without requests installed.

I'd be okay if you want to put in some skipif statements where mock fails just to see if the rest of the code works with 3.5 (and continue to add to the technical debt for me to check up on when I can :D)

PiDelport commented 8 years ago

I think those tests are actually failing due to the problem described in this article:

"assert_called_once: Threat or Menace" (Tyler Roscoe)

In short, assert_called_once() is not a valid assertion method, so the mock object treats it as a mocked method instead, and silently does nothing!

The right method to use instead is assert_called_once_with().

Python 3.5 and the newer mock library has a heuristic check which detects this, which what the Python3.5 build now fails with.

I started a branch to fix this problem.

econchick commented 8 years ago

@pjdelport you're awesome!

PiDelport commented 8 years ago

Okay, once #89 is merged, this should pass as well. :)

PiDelport commented 8 years ago

@econchick: The way attrs does it is nice!

econchick commented 8 years ago

Merging this on mobile 😜 here's hoping this works!