Skip to content

doctester: support comparison of floating point numbers + support future imports - #2051

Merged
asmeurer merged 5 commits into
sympy:masterfrom
twmr:doctest_floats
Jun 2, 2013
Merged

asmeurer merged 5 commits into
sympy:masterfrom
twmr:doctest_floats

Conversation

@twmr

@twmr twmr commented Apr 28, 2013

Copy link
Copy Markdown
Contributor

Fixes #6859

@asmeurer

Copy link
Copy Markdown
Member

It should already be supported, if I remember correctly. There may have been some issue with it in python 2.5, though.

@twmr

twmr commented Apr 28, 2013

Copy link
Copy Markdown
Contributor Author

I don't think that it is already supported. Consider the following example

def blub(x):
    """
    >>> from __future__ import division
    >>> print 1/2
    0.5
    """
   pass

The doctester seems to ignore the __future__ import statement.

@twmr

twmr commented Apr 29, 2013

Copy link
Copy Markdown
Contributor Author

I have added support for __future__ imports in my latest commits. The with_statement and the division functions automatically get imported at the beginning of each doctest. Note that >>> from __future__ import division still has no effect.

@asmeurer

Copy link
Copy Markdown
Member

Does it work in Python 2.5?

@asmeurer

Copy link
Copy Markdown
Member

Did you uncomment something slow? Two of the Travis tests timed out.

@twmr

twmr commented Apr 30, 2013

Copy link
Copy Markdown
Contributor Author

No, I don't think so. Running the whole doctests (./bin/doctest) takes 134s on my system.

@asmeurer

Copy link
Copy Markdown
Member

SymPy Bot Summary: 🔴 Failed after merging thisch/doctest_floats (7e86e2c1332bee16dcc97f4e221ed5c04c5a2985) into master (8a9d10e).
@Thisch: Please fix the test failures.
🔴 Python 2.5.6-final-0: fail
✅ Python 2.6.8-final-0: pass
✅ Python 2.7.3-final-0: pass
🔴 PyPy 1.8.0-final-0; 2.7.2-final-42: fail
✅ Python 3.2.3-final-0: pass
✅ Sphinx 1.1.3: pass
Doc Coverage: decreased
36.407% of functions have doctests (compared to 36.420% in master)
40.798% of functions are imported into Sphinx (compared to 40.777% in master)

@twmr

twmr commented May 16, 2013

Copy link
Copy Markdown
Contributor Author

Does anyone have an idea which unSKIPed doctest(s) might have caused the travis timeout?

@asmeurer

Copy link
Copy Markdown
Member

I doubt they're the culprit. The Travis tests are timing out on a regular basis these days. See https://code.google.com/p/sympy/issues/detail?id=3823. If you know how to fix, it, though, that would be awesome.

If you want to play with it, just set up the Travis hook for your personal repository, so that every branch you push is tested with Travis, even if it isn't in a pull request.

@twmr

twmr commented May 28, 2013

Copy link
Copy Markdown
Contributor Author

I fixed the problem by splitting the test jobs into doctests and normal unit tests -> #2139

https://travis-ci.org/thisch/sympy/builds/7556037

@twmr

twmr commented May 28, 2013

Copy link
Copy Markdown
Contributor Author

This is ready for merge. Any comments ?

@asmeurer

asmeurer commented Jun 2, 2013

Copy link
Copy Markdown
Member

This is great. What remains from the TODO list I enumerated a while back (was that ever converted into an issue?)?

asmeurer added a commit that referenced this pull request Jun 2, 2013
doctester: support comparison of floating point numbers + support future imports
@asmeurer
asmeurer merged commit d2819fc into sympy:master Jun 2, 2013
@twmr
twmr deleted the doctest_floats branch June 2, 2013 21:52
@twmr

twmr commented Jun 2, 2013

Copy link
Copy Markdown
Contributor Author

The TODO list you are talking about is here: #1901 (comment). The next thing I would like to focus on is point 5) randomized output. As I have already said a few months ago this point is difficult because the employed RNG algorithm has changed I think between py 2.7 and py3. I will post a question on SOF - maybe there is an alternative to monkeypatching the RNG in the stdlib and in numpy..

@twmr

twmr commented Jun 2, 2013

Copy link
Copy Markdown
Contributor Author

see #6959

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

Successfully merging this pull request may close these issues.

unskip doctests which output floats

2 participants