Re: Unit Testing Nodes

2018-10-19 Thread anlifer
Hi Edward, pythonw works for me as well - it just doesn't display anything on the console - so when I run unit tests I don't see the results. Otherwise Leo behaves fine. On Friday, October 19, 2018 at 6:37:08 AM UTC-7, Edward K. Ream wrote: > > > On Thu, Oct 18, 2018 at 6:59 PM > wrote: >

Re: Unit Testing Nodes

2018-10-19 Thread Edward K. Ream
On Thu, Oct 18, 2018 at 6:59 PM wrote: > The problem turned out to be that I was running from the command line > using pythonw instead of python. Not sure if the docs are clear on this. > When I run with python, I see the text on the console. > Thanks for this. When I execute `pythonw

Re: Unit Testing Nodes

2018-10-18 Thread anlifer
The problem turned out to be that I was running from the command line using pythonw instead of python. Not sure if the docs are clear on this. When I run with python, I see the text on the console. On Tuesday, October 16, 2018 at 8:00:16 AM UTC-7, anl...@gmail.com wrote: > > I'm using 5.7 -

Re: Unit Testing Nodes

2018-10-16 Thread Chris George
> I'm using 5.7 - perhaps I'll upgrade. I assume myLeoSettings file will be > picked up? > Just as an aside, I have been running Leo via a git pull every time for three or four years now and have had to step back to an older commit only once or twice. Chris -- You received this message

Re: Unit Testing Nodes

2018-10-16 Thread anlifer
I'm using 5.7 - perhaps I'll upgrade. I assume myLeoSettings file will be picked up? (At home right now and the issue is on my work machine - will send you the info when I go to work). Thanks Vitalije for checking if the test works. At least now I know my approach will work. On Tuesday,

Re: Unit Testing Nodes

2018-10-16 Thread vitalije
On Tuesday, October 16, 2018 at 12:30:22 PM UTC+2, Edward K. Ream wrote: > > > > On Tue, Oct 16, 2018 at 4:55 AM vitalije > > wrote: > >> How very strange. >> > > Yes, it's a mystery. anlifer, what appears in your log window when you > start Leo? This may be an installation-related problem.

Re: Unit Testing Nodes

2018-10-16 Thread Edward K. Ream
On Tue, Oct 16, 2018 at 4:55 AM vitalije wrote: > How very strange. > Yes, it's a mystery. anlifer, what appears in your log window when you start Leo? This may be an installation-related problem. > I recall that Edward recently has added some code to make output from the > console to appear

Re: Unit Testing Nodes

2018-10-16 Thread vitalije
Running all unit tests locally on the above Leo file(see previous message), on my machine produces following output: F == FAIL: runTest (leo.core.leoTest.GeneralTestCase) @test factorial

Re: Unit Testing Nodes

2018-10-16 Thread vitalije
How very strange. I recall that Edward recently has added some code to make output from the console to appear in the Log pane. I don't know if that has something to do with your issue. ... I have just updated my Leo to the latest version and it works as expected. Attached to this message is

Re: Unit Testing Nodes

2018-10-15 Thread anlifer
vitalije, I'm running from the console by running the launchLeo script from the command line. I think the tests do run - when I open the unittest.leo file and do run-all-unit-tests-locally, the window freezes - indicates something is going on. As you can see from my test, there are false

Re: Unit Testing Nodes

2018-10-15 Thread vitalije
the results should appear in the console. Leo should be started with the console and also you need to select @test node or some of its ancestors before executing run-unit-tests-locally. Try also executing tests externally. Try assert False to make test fail and see if there is any output

Re: Unit Testing Nodes

2018-10-15 Thread anlifer
Hi Vitalije, I think I have a bigger problem - see my other message. Even when I run Leo's own unit tests I get no "output". On Monday, October 15, 2018 at 2:37:32 PM UTC-7, vitalije wrote: > > you should put: > >1. @others line in @test node before assertions statements >2. put cloned

Re: Unit Testing Nodes

2018-10-15 Thread anlifer
Seems I have the same problem when I load unitTest.leo. When I run tests, I do not see their results. On Monday, October 15, 2018 at 2:29:44 PM UTC-7, anl...@gmail.com wrote: > > Thanks vitalijie. > > I think I get the idea, but I'm still having trouble. > > Let's say I start with this node

Re: Unit Testing Nodes

2018-10-15 Thread vitalije
you should put: 1. @others line in @test node before assertions statements 2. put cloned factorial node under the @test node that way the definition of the factorial function will be part of the test script that get executed by Leo's run-tests command. Vitalije On Monday, October 15,

Re: Unit Testing Nodes

2018-10-15 Thread anlifer
Thanks vitalijie. I think I get the idea, but I'm still having trouble. Let's say I start with this node (hyphen denotes a node, and indented hyphen denotes a subnode). - factorial This node contains my factorial definition. Now I'll create some more nodes so that I end up with: - factorial

Re: Unit Testing Nodes

2018-10-13 Thread Edward K. Ream
On Sat, Oct 13, 2018 at 1:49 AM vitalije wrote: > I usually make clone of the whole content of a module being tested as a > first child of a @test node, and put there in the @test node @others > directive at the top of body. After @others I write code that tests some > function from the module.

Re: Unit Testing Nodes

2018-10-13 Thread Edward K. Ream
On Fri, Oct 12, 2018 at 5:23 PM MN wrote: For the examples you gave (and your other comments in the group), it seems > like I cannot put the unit test in its own node (even as a sibling)? > I'm not sure I understand what you mean, but it's not wise to put @test nodes as children of @file, @auto

Re: Unit Testing Nodes

2018-10-13 Thread vitalije
I usually make clone of the whole content of a module being tested as a first child of a @test node, and put there in the @test node @others directive at the top of body. After @others I write code that tests some function from the module. Quite often I start developing a module without

Re: Unit Testing Nodes

2018-10-12 Thread MN
> > Any node, but @test or @button nodes are easiest to use. > > Is that defined somewhere? >> > > Yes, in the next sentence. > The sentence can be parsed in two ways: "This node (in the Leo outline) defines your development environment. You can use an @test node, an @button node, or an @command

Re: Unit Testing Nodes

2018-10-12 Thread Edward K. Ream
On Thursday, October 11, 2018 at 4:17:07 PM UTC-5, MN wrote: > What is a dev node? Any node, but @test or @button nodes are easiest to use.​ Is that defined somewhere? > Yes, in the next sentence. Suppose I have a node whose contents are: > > from operator import mul > > def

Re: Unit Testing Nodes

2018-10-11 Thread MN
> > First of all, Leo's add-comments and delete-comments commands probably do > what you want. They don't behave the way I would like. I had already been through their code (it helped me in writing my own commenting functions). There's nothing objectively wrong with Leo's commenting system -

Re: Unit Testing Nodes

2018-10-11 Thread Edward K. Ream
On Thursday, October 11, 2018 at 6:12:16 AM UTC-5, Edward K. Ream wrote: But there may be an easier way. See the FAQ entry: How can I use dev nodes > to develop and test Leo's own code? > When I originally wrote this I knew that I had documented this somewhere. It took me awhile to realize

Re: Unit Testing Nodes

2018-10-11 Thread Edward K. Ream
On Sat, Oct 6, 2018 at 8:10 AM wrote: I recently tried writing my own logic for commenting and uncommenting lines. > First of all, Leo's add-comments and delete-comments commands probably do what you want. There are unit tests in unitTest.leo. See the node Active Unit Tests-->@file

Unit Testing Nodes

2018-10-06 Thread anlifer
Hi, I recently tried writing my own logic for commenting and uncommenting lines. It has several requirements, and so I wanted to write unit tests for my logic. I tried following https://leoeditor.com/unitTesting.html but it did not really work for my use case. What I'm doing: Creating a