Re: [myhdl-list] Another typo in docs
Brought to you by:
jandecaluwe
From: Ben <ben...@gm...> - 2015-01-06 20:31:44
|
On Tue, Jan 6, 2015 at 1:10 PM, Christopher Felton <chr...@gm...> wrote: > On 1/4/15, 11:38 AM, Henry Gomersall wrote: >> On 04/01/15 17:29, Henry Gomersall wrote: >>> On 24/05/14 01:52, Christopher Felton wrote: >>>>> Here are the merged changes - I don't know if this is >>>>> the final version/format desired but it is a starting >>>>> point, I merged it to the 0.9dev branch: >>>>> >>>>> https://bitbucket.org/cfelton/myhdl_09dev_doctest/overview >>> Did you ever had this working? >>> >>> I'm getting a problem in which inspect.getsource is unable to return the >>> correct source of the function inside always_comb. >>> >>> Specifically, the source of muxLogic in comb1 in rtl.rst is given as: >>> >>> def test(): >>> print "z a b sel" >>> for i in range(8): >>> a.next, b.next, sel.next = randrange(8), randrange(8), >>> randrange(2) >>> yield delay(10) >>> print "%s %s %s %s" % (z, a, b, sel) >>> >>> i.e. the source of test(). Clearly, this means the sensitivity list is >>> not found properly with a resultant error raised by myhdl. >>> >>> The test code works fine in a standalone .py file, so it's some >>> interaction with sphinx doctest. >> >> Further to this, I've got a working doctest suite for rtl.rst. This is at: >> >> https://bitbucket.org/heng/myhdl/branch/0.9-dev >> >> I had to replicate some code in the documentation for doctest to work >> (which just makes it easier to copy and paste, though potentially open >> to replication errors down the line). The issue seemed to be related to >> globals in the doctest string, though I've not tried to hard to get to >> the bottom of it. >> > > I did not find a work around for this. Your approach is nice > to enable doctest but I am worried the maintenance will be a > pain (double code snips). Maybe there is a way using the ``doctest_global_setup`` config value [0]. The conf.py file is python so it should be possible to read (part of) another python file to populate that variable. That code would be automatically 'duplicated' on top of each file ... Just my 2c. Ben. [0] http://sphinx-doc.org/ext/doctest.html#confval-doctest_global_setup |