Closed bw-mutley closed 2 years ago
Thanks for getting this all sorted out. I can't build the examples. If I run makesheets -Fd bard3_foundry.json
, I get this error (which is not an issue on master). Thoughts?
bard3_foundry failed Traceback (most recent call last): File "/home/mwolf/miniconda3/envs/dungeonsheets/bin/makesheets", line 11, in
load_entry_point('dungeonsheets', 'console_scripts', 'makesheets')() File "/home/mwolf/src/dungeon-sheets/dungeonsheets/make_sheets.py", line 718, in main _build(filename, args) File "/home/mwolf/src/dungeon-sheets/dungeonsheets/make_sheets.py", line 610, in _build use_tex_template=args.use_tex_template, File "/home/mwolf/src/dungeon-sheets/dungeonsheets/make_sheets.py", line 189, in make_sheet use_tex_template=use_tex_template File "/home/mwolf/src/dungeon-sheets/dungeonsheets/make_sheets.py", line 532, in make_character_sheet portrait_file=portrait_file, flatten=flatten File "/home/mwolf/src/dungeon-sheets/dungeonsheets/fill_pdf_template.py", line 204, in create_personality_pdf_template return make_pdf(fields, src_pdf=src_pdf, basename=basename, flatten=flatten, portrait=portrait_file) File "/home/mwolf/src/dungeon-sheets/dungeonsheets/fill_pdf_template.py", line 511, in make_pdf _make_pdf_pdftk(fields, src_pdf, basename, flatten, portrait) File "/home/mwolf/src/dungeon-sheets/dungeonsheets/fill_pdf_template.py", line 593, in _make_pdf_pdftk make_image_pdf(portrait, image_pdf) File "/home/mwolf/src/dungeon-sheets/dungeonsheets/fill_pdf_template.py", line 632, in make_image_pdf can.drawImage(src_img, x_start, y_start, width=175, preserveAspectRatio=True, mask='auto') File "/home/mwolf/miniconda3/envs/dungeonsheets/lib/python3.7/site-packages/reportlab/pdfgen/canvas.py", line 985, in drawImage imgObj = pdfdoc.PDFImageXObject(name, image, mask=mask) File "/home/mwolf/miniconda3/envs/dungeonsheets/lib/python3.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 2099, in init ext = os.path.splitext(source)[1].lower() File "/home/mwolf/miniconda3/envs/dungeonsheets/lib/python3.7/posixpath.py", line 122, in splitext p = os.fspath(p) TypeError: expected str, bytes or os.PathLike object, not bool
Also, could you make sure there are some unit tests (in /tests directory) at least for the dice_roll_mean function, and resolving the companion content?
Hi Mark,
If I run makesheets -Fd bard3_foundry.json, I get this error (which is not an issue on master). Thoughts?
Not a clue. It was running fine here, but I tested using the compiler only. I will try to reproduce it here next week.
I guess I found it. I changed the standard character.portrait to be a bool, but I can fix that easily, just have to add some lines to make_sheets.py. How do we proceed? Push this one back and pull again? Also, can you send me or make bard3_foundry.json
avaiable to download?
Also, could you make sure there are some unit tests (in /tests directory) at least for the dice_roll_mean function, and resolving the companion content?
I would be glad to do it if I know how. I am not that experienced, in fact my purposes here is to learn how to colaborate. Can you give me some guidance for using unit tests? I mean, the very basics in this case.
How` do we proceed? Push this one back and pull again?
If you add a new commit with the change to bw-mutley:Companions-and-Weight then it should just automatically get included in this PR.
I would be glad to do it if I know how. I am not that experienced, in fact my purposes here is to learn how to colaborate. Can you give me some guidance for using unit tests? I mean, the very basics in this case.
Sure, no problem. I've added a section on running the tests with an example to the documentation.
I would start with the dice one, that's way easier to write tests for. You'll want to add a test method to tests/test_dice.py
, e.g.:
def test_dice_roll_mean(self):
# Put your tests here.
pass
then use pytest tests/test_dice.py
to run it.
When I write tests, my preference is to first make sure all the tests pass, then write a test for some simple feature (e.g. self.assertEqual(dice_roll_mean("1d6"), 3.5)
. If you haven't written the code yet, then the test will fail, so you go and write the code in dungeonsheets/dice.py
until the test passes. Then you add another test for a more complicated feature (e.g. "1d20", "2d31+45"), which most likely fails, then modify the code until it passes. By doing it this way, you know that the test is correct because it fails before you've added the feature, then you know the code is correct when it passes the test. Since you've already written the code in dungeonsheets/dice.py
, I would comment that out and uncomment it as needed to get the tests to pass.
Once you're happy with the tests, run the whole test suite and make sure everything is still good (pytest
), and push the changes. If later you find a bug, run into an edge case, or want a new feature, then write a test that addresses it and once that test passes you never have to worry about it again.
Let me know if any of that is unclear or you have other questions.
Cheers!
Hi @canismarko , finally got sometime to work on this rep. I tried to check the things you asked. Fixed the problem in make_sheets
so now it runs ok with the .json files provided in /examples
. Added tests for dice.py
new functions and for character equipment weight feature. I didn't add the tests for the companions feature yet. But if possible, I would like you to check this partial update, I can write the other tests in the weekend.
Hi there, @canismarko , just finished the tests, see if it is what you expected.
Hey, thanks @bw-mutley. I got
FileNotFoundError: [Errno 2] No such file or directory: 'HB_races.py'
Did you remember to add the file to your commits?
Hey, thanks @bw-mutley. I got
FileNotFoundError: [Errno 2] No such file or directory: 'HB_races.py'
Did you remember to add the file to your commits?
Very strange: it is in my fork. I will try to reload and pull again.
[they are supposed to be at the /examples
folder]
Also, I just find yet another small bug in MSavage form...
I figured out why it's failing. You named your example "sorcerer_ranger_test.py" and pytest tries to run it as unit-tests (since it has "test" in the name). If I rename it to "multiclass_druid_range_socerer.py" (to match the naming scheme of the existing multi-class examples), then the tests pass.
OMG, never thought about it. I will change the name in the fork.
Hi @canismarko , I see this conflict happened with `test_character.py', and since it was not here before, I guess it has to do with this merge. Before I go into resolving it though, I would like to know if you are interested in my PR or if there is anything else I have to do before pulling that again.
@bw-mutley I don't think this has anything to do with me, unless I am missing something?
@bw-mutley I don't think this has anything to do with me, unless I am missing something?
Hey Mathew! I am sorry, I wanted to cite @canismarko .
@bw-mutley I don't think this has anything to do with me, unless I am missing something?
Hey Mathew! I am sorry, I wanted to cite @canismarko .
Not a problem, just wanted the right person seeing it.
I notice you make some changes to the character template in this PR, is it still all working fine?
I notice you make some changes to the character template in this PR, is it still all working fine?
@matsavage , yes, it works fine and I love it. :D
I just made small changes in the way it is filled.
Hi, @bw-mutley. Yes, still interested. I hadn't noticed the update to the PR and thought the ball was still in your court. The conflict was related to imports and was easy to resolve so I just went ahead and did it as a merge commit. Assuming the GHA checks pass, I will merge.
HI @canismarko ! I didn't understand this part:
Assuming the GHA checks pass, I will merge.
Do I have to do anything else?
Do I have to do anything else?
Nope, GHA is "github actions". It's the automated tests that run whenever you submit a PR now (thanks to @meson800).
==Fixed version of last update try==
companions
list for including summonable and other creatures. It is resolved using_resolve_mechanic
method fromclass Content
. It also includes the beast of choice in case the character has the Beast Master subclass from the Ranger class;dice_roll_mean
now uses a updated version ofDice
indice.py
which includes amodifier
entry;equipment_reader.py
;sorcerer_druid.py
in/examples
with descriptive comments on the new entries. It also uses some homebrew features whose files were uploaded (HB_races.py
andkits.py
);create_gm_spellbook
function for proper processing of the epub format;