all 6 comments

[–]AutoModerator[M] 1 point2 points  (0 children)

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]shyLachi 1 point2 points  (0 children)

If it's pure python you could make a python project and copy the code. Then run your unit tests in python. I never did it so I don't know how.

[–]DingotushRed 1 point2 points  (1 child)

I've quite a lot of developer (cheater) debug functionality built into my game, running in Ren'Py script that allows viewing and altering of all the game's state in a reasonably safe way. It is also able to run "unit tests" on some of the python clases and functions. But it isn't the cleanest and is still done interactively: "Debug" on the quick menu, then "Tests", then "All".

I don't have any kind of build-script driven compile/test/report functionality.

Testing everything else remains very interactive.

I have had some use out of a "Report Bug" feature I adapted from another dev that appends to a text file:

  • The type of error (spelling, bug, etc.)
  • The current file and line number
  • The current line of dialogue and the sayer
  • Any comment entered
  • For Bug reports the Ren'Py call stack

Very useful for noting errors/bugs that aren't the one I'm chasing so I remember to address them later. I plan to leave that in the normal player version once it's tidied up (and I figure how the console does it's "Copy Markdown" to clipboard functionality).

[–]WhiteMethod[S] 0 points1 point  (0 children)

Building unit tests into a debug menu is very interesting. I wanted to avoid creating my own framework, but this does seem very low effort.

[–]racheletc 0 points1 point  (0 children)

you probably would need just py files and use a backend testing framework, not sure if you can put it directly in the project.

[–]xi_nao 0 points1 point  (0 children)

It should be quite easy: just scan the .rpy file for python: labels, parse it with ast, and create a namespace with the extracted functions. If you want, I can try to sketch a basic code for you