Re: warning: bug in cached @file and/or Leo Cloud plugin?
-- Forwarded message - From: Matt Wilkie Date: Sun, Oct 14, 2018 at 6:21 PM Subject: warning: bug in cached @file and/or Leo Cloud plugin? To: leo-editor Heads up: > I've just had this weird situation where I noticed the @file contents were definitely NOT the most recent version of the file. There were several sections of old content in nodes I know I'd changed over the last few days. I used "refresh from disk", after which the I saw the new content I expected. At least I'm pretty sure it's the newest content. At the same time the hierarchy changed to have nested @file nodes. A nested @file node is an indication that the gnx in the external file does not match the gnx in the outline. I'm quite sure of this because it was an issue in the new debugger code. The node "function: get_gnx_from_file" in leoDebugger.py scans the external file and sets the gnx (v.fileIndex) of a just-created @file node to the gnx in the first @+node sentinel of the external file. Leo's new read code does *not* have this logic, which results in the nested @file node. Imo, it's probably not going to help much to change Leo's read code. In fact, the strange nesting is a good indication that something is amiss. The downloaded workbook doesn't indicate much because the corresponding external files are not attached. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Weird: pytest generates "a" and "b" files
This has nothing to do with recent work. I am executing pytest from the command line on Windows. pyflakes (without args) or even pyflakes --setup-plan generates two empty text files, named "a" and "b" in the present directory. This is true even if no fixtures are found! I have looked in vain for any bug report. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Weird: pytest generates "a" and "b" files
On Mon, Oct 15, 2018 at 8:06 AM Edward K. Ream wrote: > This has nothing to do with recent work. I am executing pytest from the > command line on Windows. > > pyflakes (without args) or even pyflakes --setup-plan generates two empty > text files, named "a" and "b" in the present directory. This is true even > if no fixtures are found! I have looked in vain for any bug report. > And the --basetemp option has no effect. This is quite a mystery. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Updates to LeoVue
Ugh. The entire node/npm thing is a dog's breakfast. I have problems, as usual. Linux Mint 18 KDE node v10.12.0 npm 6.41 Running npm run build or npm run dev gets me these errors. This was after having to manually install a handful of dependencies that npm couldn't satisfy. ERROR in ./src/main.js Module not found: Error: Can't resolve 'vue-nav-tabs' in '/external/chris/working/Websites/leovue/src' @ ./src/main.js 65:18-41 ERROR in ./src/main.js Module not found: Error: Can't resolve 'vue-nav-tabs/themes/vue-tabs.scss' in '/external/chris/working/Websites/leovue/src' @ ./src/main.js 69:0-44 Any hints or tips would be much appreciated. Chris On Sunday, October 14, 2018 at 4:34:17 PM UTC-7, Joe Orr wrote: > > > >>- clicking on "Feature Introduction" and "Chunking" items in ToC >>starts a download of the .md file for that node. The other items seem to >> be >>okay >> >> That's weird, does it on FF in Mac too. But the page does display after > you get rid of the download dialog. I'll look into it. For now I'm really > only supporting Chrome though. > > >>- there's no vertical scroll bar in the rendered pane, so without a >>mouse wheel I can't see the whole page. PageDn doesn't work at first >>because keyboard focus is in the pane that was clicked (ToC). >> >> I removed the scrollbars (but not scrolling) scrolling because they > looked crappy in Windows. I could put them back as an option... Arrow keys > should work, but with mouse wheel or track pad it works better. > >> >>- wow. just wow. >> >> Glad you like it! If you have any good sample files, you can try them > out. All you need to do is put them online with an index file that points > to the CDN. > >> >>- Install too complicated: yeah. I'm going to keep chipping away at >>that. >>- Install and using LeoVue requires a webserver - maybe there's >>something in Tiddly Desktop that can be adapted ( >>https://tiddlywiki.com/static/TiddlyDesktop.html) >> >> LeoVue depends on Vue, which requires files to be served not from > filesystem. > > Joe > > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Updates to LeoVue
Success after installing more depednencies manually. I run a small web hosting operation on the side. Now to find a way to install this entire infrastructure on cPanel without terminal access to the server. :-( cPanel is still about a year away from rolling node/npm as supported infrastructure. Chris On Monday, October 15, 2018 at 7:36:10 AM UTC-7, Chris George wrote: > > Ugh. The entire node/npm thing is a dog's breakfast. I have problems, as > usual. > > Linux Mint 18 KDE > node v10.12.0 > npm 6.41 > > Running npm run build or npm run dev gets me these errors. This was after > having to manually install a handful of dependencies that npm couldn't > satisfy. > > ERROR in ./src/main.js > Module not found: Error: Can't resolve 'vue-nav-tabs' in > '/external/chris/working/Websites/leovue/src' > @ ./src/main.js 65:18-41 > > ERROR in ./src/main.js > Module not found: Error: Can't resolve 'vue-nav-tabs/themes/vue-tabs.scss' > in '/external/chris/working/Websites/leovue/src' > @ ./src/main.js 69:0-44 > > Any hints or tips would be much appreciated. > > Chris > > On Sunday, October 14, 2018 at 4:34:17 PM UTC-7, Joe Orr wrote: >> >> >> >>>- clicking on "Feature Introduction" and "Chunking" items in ToC >>>starts a download of the .md file for that node. The other items seem to >>> be >>>okay >>> >>> That's weird, does it on FF in Mac too. But the page does display after >> you get rid of the download dialog. I'll look into it. For now I'm really >> only supporting Chrome though. >> >> >>>- there's no vertical scroll bar in the rendered pane, so without a >>>mouse wheel I can't see the whole page. PageDn doesn't work at first >>>because keyboard focus is in the pane that was clicked (ToC). >>> >>> I removed the scrollbars (but not scrolling) scrolling because they >> looked crappy in Windows. I could put them back as an option... Arrow keys >> should work, but with mouse wheel or track pad it works better. >> >>> >>>- wow. just wow. >>> >>> Glad you like it! If you have any good sample files, you can try them >> out. All you need to do is put them online with an index file that points >> to the CDN. >> >>> >>>- Install too complicated: yeah. I'm going to keep chipping away at >>>that. >>>- Install and using LeoVue requires a webserver - maybe there's >>>something in Tiddly Desktop that can be adapted ( >>>https://tiddlywiki.com/static/TiddlyDesktop.html) >>> >>> LeoVue depends on Vue, which requires files to be served not from >> filesystem. >> >> Joe >> >> > -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: FYI: I'll be removing leo/external/rope
On Sunday, October 14, 2018 at 4:01:06 PM UTC-5, Edward K. Ream wrote: > > > Rev ea79240bb changes leoRope.py so that it fails gracefully if rope does >> not exist. Rev f5a3ef694 deletes the rope folder. All tests pass. >> > > But somehow this breaks TravisCI. > The traceback from TravisCI pinpoints the failing unit test, @test g.importModule. Rev cdb2d613 fixes this. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Weird: pytest generates "a" and "b" files
> This has nothing to do with recent work. I am executing pytest from the command line on Windows. Mystery solved, and fixed at 16011ec6. The culprit was python3_test.py. python3_test.py created the "a" and "b" files with module level code! I found this file by brute force, deleting all files from the unittest directory and then adding files back until the problem reappeared. The problem did not happen during unit testing because `@test Python3 features` does not import this file, it merely compiles it ast.parse. In contrast, pytest actually imports the file. This code has now been disabled with an `if 0:` statement, which retains the code for ast.parse without doing anything harmful at import time. A relatively small price to pay for making pytest work smoothly. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Updates to LeoVue
Red Hat Openshift provides a free node.js environment online but after an hour of trying to suss out how to marry LeoVue with that I am going back to writing. My brain hurts. Chris On Monday, October 15, 2018 at 8:01:37 AM UTC-7, Chris George wrote: > > Success after installing more depednencies manually. > > I run a small web hosting operation on the side. Now to find a way to > install this entire infrastructure on cPanel without terminal access to the > server. :-( > > cPanel is still about a year away from rolling node/npm as supported > infrastructure. > > Chris > > On Monday, October 15, 2018 at 7:36:10 AM UTC-7, Chris George wrote: >> >> Ugh. The entire node/npm thing is a dog's breakfast. I have problems, as >> usual. >> >> Linux Mint 18 KDE >> node v10.12.0 >> npm 6.41 >> >> Running npm run build or npm run dev gets me these errors. This was after >> having to manually install a handful of dependencies that npm couldn't >> satisfy. >> >> ERROR in ./src/main.js >> Module not found: Error: Can't resolve 'vue-nav-tabs' in >> '/external/chris/working/Websites/leovue/src' >> @ ./src/main.js 65:18-41 >> >> ERROR in ./src/main.js >> Module not found: Error: Can't resolve >> 'vue-nav-tabs/themes/vue-tabs.scss' in >> '/external/chris/working/Websites/leovue/src' >> @ ./src/main.js 69:0-44 >> >> Any hints or tips would be much appreciated. >> >> Chris >> >> On Sunday, October 14, 2018 at 4:34:17 PM UTC-7, Joe Orr wrote: >>> >>> >>> - clicking on "Feature Introduction" and "Chunking" items in ToC starts a download of the .md file for that node. The other items seem to be okay That's weird, does it on FF in Mac too. But the page does display after >>> you get rid of the download dialog. I'll look into it. For now I'm really >>> only supporting Chrome though. >>> >>> - there's no vertical scroll bar in the rendered pane, so without a mouse wheel I can't see the whole page. PageDn doesn't work at first because keyboard focus is in the pane that was clicked (ToC). I removed the scrollbars (but not scrolling) scrolling because they >>> looked crappy in Windows. I could put them back as an option... Arrow keys >>> should work, but with mouse wheel or track pad it works better. >>> - wow. just wow. Glad you like it! If you have any good sample files, you can try them >>> out. All you need to do is put them online with an index file that points >>> to the CDN. >>> - Install too complicated: yeah. I'm going to keep chipping away at that. - Install and using LeoVue requires a webserver - maybe there's something in Tiddly Desktop that can be adapted ( https://tiddlywiki.com/static/TiddlyDesktop.html) LeoVue depends on Vue, which requires files to be served not from >>> filesystem. >>> >>> Joe >>> >>> >> -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Docker for LeoVue etc.
Responding to Chris's comments re cPanel / LeoVue etc., just a PSA, Docker is easier and more useful than you think ;-) It sits less comfortably in Windows than it does in Linux, but it gives an extremely clear cut curated environment and is really not complicated to use if you're at all familiar with the command line. Here's a page on dockerizing a node app.: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/ But my more general point is that Docker's much easier than you think, and much lighter weight than using virtual machines for clean / disposable environments. I with I'd looked into it years ago. It would be east to make a Docker image for Leo, but running GUI apps. is really only straightforward in unix/X11, much more trouble in Windows. Cheers -Terry -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To post to this group, send email to leo-editor@googlegroups.com. Visit this group at https://groups.google.com/group/leo-editor. For more options, visit https://groups.google.com/d/optout.
Re: Unit Testing Nodes
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 (clone) - Tests - factorial (clone) - @test Test Factorial The @test node contains the following lines: self.assertEqual(factorial(5), 121) self.assertEqual(factorial(5), 122) assert (factorial(5)==120) The "Tests" node contains the following: @language python @others Now when I run "run-all-unit-tests-locally" I don't see any results. I know the command does something because I see the nodes change/flicker momentarily. I looked at the console window (https://leoeditor.com/installing.html#running-leo-from-a-console-window) and ran it from the command line, but I still see nothing. Things I tried: 1. Quitting and restarting. 2. Remove @others above 3. Added the preamble in https://leoeditor.com/unitTesting.html#test-driven-development-in-leo in the Tests node. Toggled the if 0 to if 1 but it made no difference. What am I missing? On Friday, October 12, 2018 at 11:49:24 PM UTC-7, 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. > > Quite often I start developing a module without creating an external file. > The whole development module is under one node that is cloned under several > @test nodes, and only after I am satisfied with the code, I just make > another clone and put it under some @clean or @file node as the only top > level child to create external file. > > This works very well for me when developing Python. When I am writing in > CoffeeScript I use cloned content of a module in two different external > files: one is a regular CoffeeScript module, and the other is saved under > /test/ folder and usually in a file named "test_.coffee". > > [image: leo-unit-testing.png] > For example in the above picture you can see two @clean nodes: > >1. @clean coffee/ev-3.coffee >2. @clean test/spec/spec3-1.coffee > > Both of this two nodes have under them cloned node `ev-3 kod` which > contains all definitions (functions, constants, singleton instances, ...). > Node named 'izEvidencije` contains just some comments and @others line. So, > all those definitions are defined and present in both files > coffee/ev-3.coffee and test/spec/spec3-1.coffee. In the spec3-1.coffee > there is a node `specifikacije` which contains all specs that are > describing (and testing) behavior of ev-3.coffee module. > > For Python development, it is even easier because Leo executes test nodes > on the fly, so there is no need for the external test file, but if you do > wish to create test files and use some other test runner you can use the > same technique as in the above example for CoffeeScript. > > HTH > Vitalije > > On Saturday, October 13, 2018 at 12:23:32 AM UTC+2, MN wrote: >> >> 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 node" >> >> I read it as "There is something called a dev node" and "You can make a >> dev node a @test, @button or @command node". It sounded like a dev node is >> a node with a special property (e.g. a cloned node is visually different >> from a regular node), and then you can make THAT dev node a @test node. I >> think a better phrasing would be: >> >> "A dev node is defined as any node that is either a @test, @button or >> @command node." >> >> 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)? >> >> On Fri, Oct 12, 2018 at 2:11 AM Edward K. Ream wrote: >> >>> 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 factorial(number): if number < 0: raise ValueError if number == 0: return 1 return reduce(mul, range(number+1), 1) It's a simple function. Imagine this is a helper function that will be used by some other function that interacts with Leo. It is not saved to any file (beyond the .leo file, of course). I would like to create a unit test for this. What is the best way? >>> >>> There are several ways. >>
Re: Unit Testing Nodes
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, 2018 at 11:29:44 PM UTC+2, 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 (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 (clone) > - Tests > - factorial (clone) > - @test Test Factorial > > The @test node contains the following lines: > > self.assertEqual(factorial(5), 121) > self.assertEqual(factorial(5), 122) > assert (factorial(5)==120) > > The "Tests" node contains the following: > > @language python > @others > > Now when I run "run-all-unit-tests-locally" I don't see any results. I > know the command does something because I see the nodes change/flicker > momentarily. I looked at the console window ( > https://leoeditor.com/installing.html#running-leo-from-a-console-window) > and ran it from the command line, but I still see nothing. > > Things I tried: > > 1. Quitting and restarting. > 2. Remove @others above > 3. Added the preamble in > https://leoeditor.com/unitTesting.html#test-driven-development-in-leo in > the Tests node. Toggled the if 0 to if 1 but it made no difference. > > What am I missing? > > On Friday, October 12, 2018 at 11:49:24 PM UTC-7, 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. >> >> Quite often I start developing a module without creating an external >> file. The whole development module is under one node that is cloned under >> several @test nodes, and only after I am satisfied with the code, I just >> make another clone and put it under some @clean or @file node as the only >> top level child to create external file. >> >> This works very well for me when developing Python. When I am writing in >> CoffeeScript I use cloned content of a module in two different external >> files: one is a regular CoffeeScript module, and the other is saved under >> /test/ folder and usually in a file named "test_.coffee". >> >> [image: leo-unit-testing.png] >> For example in the above picture you can see two @clean nodes: >> >>1. @clean coffee/ev-3.coffee >>2. @clean test/spec/spec3-1.coffee >> >> Both of this two nodes have under them cloned node `ev-3 kod` which >> contains all definitions (functions, constants, singleton instances, ...). >> Node named 'izEvidencije` contains just some comments and @others line. So, >> all those definitions are defined and present in both files >> coffee/ev-3.coffee and test/spec/spec3-1.coffee. In the spec3-1.coffee >> there is a node `specifikacije` which contains all specs that are >> describing (and testing) behavior of ev-3.coffee module. >> >> For Python development, it is even easier because Leo executes test nodes >> on the fly, so there is no need for the external test file, but if you do >> wish to create test files and use some other test runner you can use the >> same technique as in the above example for CoffeeScript. >> >> HTH >> Vitalije >> >> On Saturday, October 13, 2018 at 12:23:32 AM UTC+2, MN wrote: >>> >>> 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 node" >>> >>> I read it as "There is something called a dev node" and "You can make a >>> dev node a @test, @button or @command node". It sounded like a dev node is >>> a node with a special property (e.g. a cloned node is visually different >>> from a regular node), and then you can make THAT dev node a @test node. I >>> think a better phrasing would be: >>> >>> "A dev node is defined as any node that is either a @test, @button or >>> @command node." >>> >>> 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)? >>> >>> On Fri, Oct 12, 2018 at 2:11 AM Edward K. Ream >>> wrote: >>> 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
Re: Unit Testing Nodes
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 (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 (clone) > - Tests > - factorial (clone) > - @test Test Factorial > > The @test node contains the following lines: > > self.assertEqual(factorial(5), 121) > self.assertEqual(factorial(5), 122) > assert (factorial(5)==120) > > The "Tests" node contains the following: > > @language python > @others > > Now when I run "run-all-unit-tests-locally" I don't see any results. I > know the command does something because I see the nodes change/flicker > momentarily. I looked at the console window ( > https://leoeditor.com/installing.html#running-leo-from-a-console-window) > and ran it from the command line, but I still see nothing. > > Things I tried: > > 1. Quitting and restarting. > 2. Remove @others above > 3. Added the preamble in > https://leoeditor.com/unitTesting.html#test-driven-development-in-leo in > the Tests node. Toggled the if 0 to if 1 but it made no difference. > > What am I missing? > > On Friday, October 12, 2018 at 11:49:24 PM UTC-7, 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. >> >> Quite often I start developing a module without creating an external >> file. The whole development module is under one node that is cloned under >> several @test nodes, and only after I am satisfied with the code, I just >> make another clone and put it under some @clean or @file node as the only >> top level child to create external file. >> >> This works very well for me when developing Python. When I am writing in >> CoffeeScript I use cloned content of a module in two different external >> files: one is a regular CoffeeScript module, and the other is saved under >> /test/ folder and usually in a file named "test_.coffee". >> >> [image: leo-unit-testing.png] >> For example in the above picture you can see two @clean nodes: >> >>1. @clean coffee/ev-3.coffee >>2. @clean test/spec/spec3-1.coffee >> >> Both of this two nodes have under them cloned node `ev-3 kod` which >> contains all definitions (functions, constants, singleton instances, ...). >> Node named 'izEvidencije` contains just some comments and @others line. So, >> all those definitions are defined and present in both files >> coffee/ev-3.coffee and test/spec/spec3-1.coffee. In the spec3-1.coffee >> there is a node `specifikacije` which contains all specs that are >> describing (and testing) behavior of ev-3.coffee module. >> >> For Python development, it is even easier because Leo executes test nodes >> on the fly, so there is no need for the external test file, but if you do >> wish to create test files and use some other test runner you can use the >> same technique as in the above example for CoffeeScript. >> >> HTH >> Vitalije >> >> On Saturday, October 13, 2018 at 12:23:32 AM UTC+2, MN wrote: >>> >>> 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 node" >>> >>> I read it as "There is something called a dev node" and "You can make a >>> dev node a @test, @button or @command node". It sounded like a dev node is >>> a node with a special property (e.g. a cloned node is visually different >>> from a regular node), and then you can make THAT dev node a @test node. I >>> think a better phrasing would be: >>> >>> "A dev node is defined as any node that is either a @test, @button or >>> @command node." >>> >>> 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)? >>> >>> On Fri, Oct 12, 2018 at 2:11 AM Edward K. Ream >>> wrote: >>> 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 factorial(number): > if number < 0: > raise ValueError > if number == 0: > return 1 > return reduce(mul
Re: Unit Testing Nodes
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 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. > It should look like: > -factorial (clone) > -Tests > -@test Test Factorial > -factorial(clone) > > > Vitalije > > On Monday, October 15, 2018 at 11:29:44 PM UTC+2, 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 (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 (clone) >> - Tests >> - factorial (clone) >> - @test Test Factorial >> >> The @test node contains the following lines: >> >> self.assertEqual(factorial(5), 121) >> self.assertEqual(factorial(5), 122) >> assert (factorial(5)==120) >> >> The "Tests" node contains the following: >> >> @language python >> @others >> >> Now when I run "run-all-unit-tests-locally" I don't see any results. I >> know the command does something because I see the nodes change/flicker >> momentarily. I looked at the console window ( >> https://leoeditor.com/installing.html#running-leo-from-a-console-window) >> and ran it from the command line, but I still see nothing. >> >> Things I tried: >> >> 1. Quitting and restarting. >> 2. Remove @others above >> 3. Added the preamble in >> https://leoeditor.com/unitTesting.html#test-driven-development-in-leo in >> the Tests node. Toggled the if 0 to if 1 but it made no difference. >> >> What am I missing? >> >> On Friday, October 12, 2018 at 11:49:24 PM UTC-7, 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. >>> >>> Quite often I start developing a module without creating an external >>> file. The whole development module is under one node that is cloned under >>> several @test nodes, and only after I am satisfied with the code, I just >>> make another clone and put it under some @clean or @file node as the only >>> top level child to create external file. >>> >>> This works very well for me when developing Python. When I am writing in >>> CoffeeScript I use cloned content of a module in two different external >>> files: one is a regular CoffeeScript module, and the other is saved under >>> /test/ folder and usually in a file named "test_.coffee". >>> >>> [image: leo-unit-testing.png] >>> For example in the above picture you can see two @clean nodes: >>> >>>1. @clean coffee/ev-3.coffee >>>2. @clean test/spec/spec3-1.coffee >>> >>> Both of this two nodes have under them cloned node `ev-3 kod` which >>> contains all definitions (functions, constants, singleton instances, ...). >>> Node named 'izEvidencije` contains just some comments and @others line. So, >>> all those definitions are defined and present in both files >>> coffee/ev-3.coffee and test/spec/spec3-1.coffee. In the spec3-1.coffee >>> there is a node `specifikacije` which contains all specs that are >>> describing (and testing) behavior of ev-3.coffee module. >>> >>> For Python development, it is even easier because Leo executes test >>> nodes on the fly, so there is no need for the external test file, but if >>> you do wish to create test files and use some other test runner you can use >>> the same technique as in the above example for CoffeeScript. >>> >>> HTH >>> Vitalije >>> >>> On Saturday, October 13, 2018 at 12:23:32 AM UTC+2, MN wrote: 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 node" I read it as "There is something called a dev node" and "You can make a dev node a @test, @button or @command node". It sounded like a dev node is a node with a special property (e.g. a cloned node is visually different from a regular node), and then you can make THAT dev node a @test node. I think a better phrasing would be: "A dev node is defined as any node that is either a @test, @button or @command node." For the examples you gave (and your other comments in the group), it seems like I cannot put the unit test in its own
Re: Unit Testing Nodes
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 On Monday, October 15, 2018 at 11:45:10 PM UTC+2, anl...@gmail.com wrote: > > 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 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. >> It should look like: >> -factorial (clone) >> -Tests >> -@test Test Factorial >> -factorial(clone) >> >> >> Vitalije >> >> On Monday, October 15, 2018 at 11:29:44 PM UTC+2, 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 (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 (clone) >>> - Tests >>> - factorial (clone) >>> - @test Test Factorial >>> >>> The @test node contains the following lines: >>> >>> self.assertEqual(factorial(5), 121) >>> self.assertEqual(factorial(5), 122) >>> assert (factorial(5)==120) >>> >>> The "Tests" node contains the following: >>> >>> @language python >>> @others >>> >>> Now when I run "run-all-unit-tests-locally" I don't see any results. I >>> know the command does something because I see the nodes change/flicker >>> momentarily. I looked at the console window ( >>> https://leoeditor.com/installing.html#running-leo-from-a-console-window) >>> and ran it from the command line, but I still see nothing. >>> >>> Things I tried: >>> >>> 1. Quitting and restarting. >>> 2. Remove @others above >>> 3. Added the preamble in >>> https://leoeditor.com/unitTesting.html#test-driven-development-in-leo >>> in the Tests node. Toggled the if 0 to if 1 but it made no difference. >>> >>> What am I missing? >>> >>> On Friday, October 12, 2018 at 11:49:24 PM UTC-7, 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. Quite often I start developing a module without creating an external file. The whole development module is under one node that is cloned under several @test nodes, and only after I am satisfied with the code, I just make another clone and put it under some @clean or @file node as the only top level child to create external file. This works very well for me when developing Python. When I am writing in CoffeeScript I use cloned content of a module in two different external files: one is a regular CoffeeScript module, and the other is saved under /test/ folder and usually in a file named "test_.coffee". [image: leo-unit-testing.png] For example in the above picture you can see two @clean nodes: 1. @clean coffee/ev-3.coffee 2. @clean test/spec/spec3-1.coffee Both of this two nodes have under them cloned node `ev-3 kod` which contains all definitions (functions, constants, singleton instances, ...). Node named 'izEvidencije` contains just some comments and @others line. So, all those definitions are defined and present in both files coffee/ev-3.coffee and test/spec/spec3-1.coffee. In the spec3-1.coffee there is a node `specifikacije` which contains all specs that are describing (and testing) behavior of ev-3.coffee module. For Python development, it is even easier because Leo executes test nodes on the fly, so there is no need for the external test file, but if you do wish to create test files and use some other test runner you can use the same technique as in the above example for CoffeeScript. HTH Vitalije On Saturday, October 13, 2018 at 12:23:32 AM UTC+2, MN wrote: > > 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 node" > > I read it as "There is something called a dev node" and "You can mak
Re: Unit Testing Nodes
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 assertions. No output. On Monday, October 15, 2018 at 4:36:39 PM UTC-7, vitalije wrote: > > 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 > > > On Monday, October 15, 2018 at 11:45:10 PM UTC+2, anl...@gmail.com wrote: >> >> 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 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. >>> It should look like: >>> -factorial (clone) >>> -Tests >>> -@test Test Factorial >>> -factorial(clone) >>> >>> >>> Vitalije >>> >>> On Monday, October 15, 2018 at 11:29:44 PM UTC+2, 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 (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 (clone) - Tests - factorial (clone) - @test Test Factorial The @test node contains the following lines: self.assertEqual(factorial(5), 121) self.assertEqual(factorial(5), 122) assert (factorial(5)==120) The "Tests" node contains the following: @language python @others Now when I run "run-all-unit-tests-locally" I don't see any results. I know the command does something because I see the nodes change/flicker momentarily. I looked at the console window ( https://leoeditor.com/installing.html#running-leo-from-a-console-window) and ran it from the command line, but I still see nothing. Things I tried: 1. Quitting and restarting. 2. Remove @others above 3. Added the preamble in https://leoeditor.com/unitTesting.html#test-driven-development-in-leo in the Tests node. Toggled the if 0 to if 1 but it made no difference. What am I missing? On Friday, October 12, 2018 at 11:49:24 PM UTC-7, 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. > > Quite often I start developing a module without creating an external > file. The whole development module is under one node that is cloned under > several @test nodes, and only after I am satisfied with the code, I just > make another clone and put it under some @clean or @file node as the only > top level child to create external file. > > This works very well for me when developing Python. When I am writing > in CoffeeScript I use cloned content of a module in two different > external > files: one is a regular CoffeeScript module, and the other is saved under > /test/ folder and usually in a file named "test_.coffee". > > [image: leo-unit-testing.png] > For example in the above picture you can see two @clean nodes: > >1. @clean coffee/ev-3.coffee >2. @clean test/spec/spec3-1.coffee > > Both of this two nodes have under them cloned node `ev-3 kod` which > contains all definitions (functions, constants, singleton instances, > ...). > Node named 'izEvidencije` contains just some comments and @others line. > So, > all those definitions are defined and present in both files > coffee/ev-3.coffee and test/spec/spec3-1.coffee. In the spec3-1.coffee > there is a node `specifikacije` which contains all specs that are > describing (and testing) behavior of ev-3.coffee module. > > For Python development, it is even easier because Leo executes test > nodes on the fly, so there is no need for the external test file, but if > you do wish to create test files and use some other test runner you can > use > the same technique as in the above example for CoffeeScript. > > HTH > Vitalij