Dear Leo Developer,

I am writing a script in Leo, it is located in the body of a @button node.

As adding more and more logic to the script, I feel I need to have some
test case to make me confident on the development progress.


As the moment, I am adding test case as below:

def func1():

...

def func2():

...

def main():

.....


def test_scenario1():

func1()

func2()

def test_scenario2():

func2()

func1()

def test_main():

#test_scenario1()

test_scenario2()

c.redraw()

test_main()

#main()


I created a test_main() and put the test logic there. Using ctrl-b to see
the result of test_main().


It's not a good way:

1) The test cases and production code are mixed

2) Need manually disable/enable for different test scenarios.


I'm thinking to use python unittest library, but the way I use unittest
before was in command line, create a dedicated "test_button_body_code.py"
and "import button_body_code" to test button_body_code.py.


How shall I do the similar thing for leo @button script?

Or any other best practice for testing the script in the body of @button?


Best Regards,

Austin

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAEpKVv_-URmxjabJA-OvcDMCpCD%2BaWnPvQZJDSp5vuuX_pcp7Q%40mail.gmail.com.

Reply via email to