DeckofAdventures / TheGame

Welcome to Deck of Adventures, The Game.
https://deckofadventures.github.io/TheGame/
Other
4 stars 3 forks source link

Add pytests #182

Closed CBroz1 closed 1 year ago

CBroz1 commented 1 year ago

Testing

I took a pass to automate running the code and catch when something breaks. This does not go so far as to check that the output matches expectations, but I think we can review together and build in more assumptions based on the output we see.

When run, returns the following code coverage...

> pytest
====================================== test session starts =======================================
platform linux -- Python 3.9.16, pytest-7.3.1, pluggy-1.0.0
rootdir: /home/cb/fun/TheGame
configfile: pyproject.toml
testpaths: tests
plugins: anyio-3.6.2, cov-4.0.0
collected 36 items                                                                               

tests/test_export.py ...                                                                   [  8%]
tests/test_sim_deck.py .......                                                             [ 27%]
tests/test_sim_encounter.py .......                                                        [ 47%]
tests/test_sim_player.py ......                                                            [ 63%]
tests/test_templates.py ...........                                                        [ 94%]
tests/test_utils.py ..                                                                     [100%]

---------- coverage: platform linux, python 3.9.16-final-0 -----------
Name                                  Stmts   Miss  Cover   Missing
-------------------------------------------------------------------
automation/__init__.py                    0      0   100%
automation/pdf/__init__.py                2      0   100%
automation/pdf/split_premades.py         21      1    95%   45
automation/simulator/__init__.py          0      0   100%
automation/simulator/deck.py            160      1    99%   181
automation/simulator/encounter.py       113      1    99%   76
automation/simulator/player.py          195      2    99%   261, 301
automation/templates/__init__.py          3      0   100%
automation/templates/bestiary.py        291      4    99%   87, 342, 352, 525
automation/templates/items.py           161      5    97%   65, 109, 116-117, 220
automation/templates/powers.py          176      1    99%   93
automation/templates/yaml_spec.py       140      5    96%   34, 116, 121, 127, 203
automation/utils/__init__.py              6      0   100%
automation/utils/dataclass_utils.py       7      0   100%
automation/utils/dict_manip.py           22      0   100%
automation/utils/list_manip.py           15      0   100%
automation/utils/logger.py                9      0   100%
automation/utils/logger_csv.py           11      0   100%
automation/utils/md_utils.py             10      0   100%
-------------------------------------------------------------------
TOTAL                                  1342     20    99%

====================================== 36 passed in 14.83s ======================================

Other changes

  1. I replaced the complicated Docker framework with a shell script that will
    • (a) change the site for versioning, i.e. #132
    • (b) fix the crashing github actions
    • (c) automatically generate all md/tsv files when deploying docs
  2. I edited the site's CSS to reflect my placeholder icon's color scheme (see docs/src/stylesheets/extras.css) or my fork's site. Notably, I now pull from code docstrings to summarize functionality (TOC here)
  3. Proposes adds for #78 and #129
  4. I propose a change to how we're versioning. We've been on alpha versions for a while 1.0.0aX. I propose we make better use of the patch version my reserving major versions for 'test-worthy'. This essentially makes open-beta 1.1.0. If accepted, I'll change our milestones accordingly.
  5. I added links to the changelog to direct to the the tag for that stage. If we'd like to migrate to a 'release' system, we can make use of github's release notes feature, but I don't think this is necessary.
  6. I made general markdown linting and spell check changes. All license changes fall under this domain.
  7. I removed templates from the SAMPLE docs to keep them in the official version as a single source of truth.
LockerM commented 1 year ago

New commits/changes look good to me. Anything left outstanding before we merge?

CBroz1 commented 1 year ago

Hi @LockerM, I was able to resolve the image issue. It has to do with how chrome is installed, which is tough, because that's not something I can enforce with config files. For now, I can generate sheets, but we'll have to debug for any new machines that we use to generate sheets. I'd like to move forward with the merge, and we can consider other options for this process in the future