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

Make Cython modules work with doctest #949

Closed
robertwb opened this issue Oct 3, 2009 · 10 comments
Closed

Make Cython modules work with doctest #949

robertwb opened this issue Oct 3, 2009 · 10 comments

Comments

@robertwb
Copy link
Contributor

robertwb commented Oct 3, 2009

A new directive "autotestdict" (might default to True unless opposition appears on ML). When enabled, and a __test__ dictionary is not already present, one is created containing all functions and methods with docstrings in the file, so that they get picked up by doctest.

http://thread.gmane.org/gmane.comp.python.cython.devel/7626

Migrated from http://trac.cython.org/ticket/387

@robertwb
Copy link
Contributor Author

robertwb commented Oct 3, 2009

@dagss changed owner from somebody to dagss
status from new to assigned
commented

@robertwb
Copy link
Contributor Author

robertwb commented Oct 3, 2009

@dagss changed resolution to fixed
status from assigned to closed
commented

http://hg.cython.org/cython-unstable/rev/6371ba048f68
http://hg.cython.org/cython-unstable/rev/7e2cbc8f78ac

I'll also make it the default in an upcoming changeset.

@robertwb
Copy link
Contributor Author

robertwb commented Oct 3, 2009

@dagss changed resolution from fixed to empty
status from closed to reopened
commented

There's a problem with cdef functions getting picked up, reopening (it's not turned on by default so no problem).

@robertwb
Copy link
Contributor Author

robertwb commented Oct 5, 2009

@dagss changed description from

A new directive doctesthack (might default to True unless opposition appears on ML). When enabled, and a __test__ dictionary is not already present, one is created containing all functions and methods with docstrings in the file, so that they get picked up by doctest.

http://thread.gmane.org/gmane.comp.python.cython.devel/7626

to

A new directive "autotestdict" (might default to True unless opposition appears on ML). When enabled, and a __test__ dictionary is not already present, one is created containing all functions and methods with docstrings in the file, so that they get picked up by doctest.

http://thread.gmane.org/gmane.comp.python.cython.devel/7626
resolution to fixed
status from reopened to closed
commented

OK this is done now. The directive is renamed to autotestdict.

@robertwb
Copy link
Contributor Author

@dagss changed milestone from 0.12 to 0.12.1
resolution from fixed to empty
status from closed to reopened
commented

A new approach is needed; not all slots in cdef classes are available from Python space.

The best solution is probably:

  1. Generate __linenumbers__ dict statically
  2. Insert code in module startup to build __test__ dynamically from dir() and __linenumbers__.

This is much easier to do once CythonUtilityCode is merged, which makes it more suitable for 0.12.1.

It could be turned off by default until that can be done if this is too much of an issue.

This hack (http://hg.cython.org/cython-devel/rev/48ab4c8c76d1) should at least get Sage to compile, I think, but it is not even complete with regards to slot names.

@robertwb
Copy link
Contributor Author

@dagss changed milestone from 0.12.1 to 0.12
commented

I guess the issue of whether it should be default should be revisited before pushing the ticket to 0.12.1.

@robertwb
Copy link
Contributor Author

robertwb commented Nov 2, 2009

@dagss changed milestone from 0.12 to 0.12.1
commented

The blacklist has seen some more work/modifications and should be rather safe. We rather quickly started to depend on this feature (both in our tests and in my personal project code) so this should probably be left on by default for 0.12. Moving to 0.12.1 to revisit the question of the best implementation.

@robertwb
Copy link
Contributor Author

@dagss changed milestone from 0.12.1 to wishlist
summary from

Make Cython modules work with doctest

to

Improve Cython test dict implementation
commented

@robertwb
Copy link
Contributor Author

@dagss changed milestone from wishlist to 0.12
summary from

Improve Cython test dict implementation

to

Make Cython modules work with doctest
commented

On second thought, I'm opening a new ticket for improvement so that this gets into release history...

@robertwb
Copy link
Contributor Author

robertwb commented Jan 31, 2010

@dagss changed resolution to fixed
status from reopened to closed
commented

Follow-up on http://trac.cython.org/ticket/497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant