Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove legacy code and add coverage #96

Merged
merged 5 commits into from
Apr 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
16 changes: 8 additions & 8 deletions examples/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
from pyglet.window import key

import cocos
from shimmer.display.components.box_layout import create_box_layout, BoxLayoutDefinition
from shimmer.display.components.font import FontDefinition
from shimmer.display.data_structures import White, Black
from shimmer.display.keyboard import (
from shimmer.components.box_layout import create_box_layout, BoxLayoutDefinition
from shimmer.components.font import FontDefinition
from shimmer.data_structures import White, Black
from shimmer.keyboard import (
KeyboardActionDefinition,
KeyboardHandlerDefinition,
KeyboardHandler,
ChordDefinition,
)
from shimmer.display.widgets.button import ButtonDefinition, Button
from shimmer.display.widgets.text_box import TextBoxDefinition, TextBox
from shimmer.display.widgets.window import WindowDefinition, Window
from shimmer.widgets.button import ButtonDefinition, Button
from shimmer.widgets.text_box import TextBoxDefinition, TextBox
from shimmer.widgets.window import WindowDefinition, Window


class Calculator(Window):
Expand All @@ -28,7 +28,7 @@ class Calculator(Window):
["1", "2", "3", "/"],
["C", "0", "=", "*"],
]
layout_definition = BoxLayoutDefinition(boxes_per_row=4, boxes_per_column=4)
layout_definition = BoxLayoutDefinition(num_columns=4, num_rows=4)

def __init__(self):
"""Create a Calculator."""
Expand Down
10 changes: 5 additions & 5 deletions examples/letter_shooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
from string import ascii_lowercase

import cocos
from shimmer.display.components.box import Box, BoxDefinition
from shimmer.display.components.focus import (
from shimmer.components.box import Box, BoxDefinition
from shimmer.components.focus import (
FocusBoxDefinition,
make_focusable,
EVENT_HANDLED,
)
from shimmer.display.data_structures import Color
from shimmer.display.keyboard import add_simple_keyboard_handler
from shimmer.display.widgets.text_box import TextBoxDefinition, TextBox
from shimmer.data_structures import Color
from shimmer.keyboard import add_simple_keyboard_handler
from shimmer.widgets.text_box import TextBoxDefinition, TextBox


@dataclass(frozen=True)
Expand Down
12 changes: 6 additions & 6 deletions examples/shooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
from cocos.actions.instant_actions import CallFunc
from cocos.actions.interval_actions import MoveTo
from cocos.euclid import Vector2
from shimmer.display.alignment import LeftTop
from shimmer.display.components.box import Box, BoxDefinition, DynamicSizeBehaviourEnum
from shimmer.display.components.mouse_box import MouseBox, MouseBoxDefinition
from shimmer.display.components.sprite_box import SpriteBoxDefinition, SpriteBox
from shimmer.display.primitives import Point2d, Color
from shimmer.display.widgets.text_box import TextBoxDefinition, TextBox
from shimmer.alignment import LeftTop
from shimmer.components.box import Box, BoxDefinition, DynamicSizeBehaviourEnum
from shimmer.components.mouse_box import MouseBox, MouseBoxDefinition
from shimmer.components.sprite_box import SpriteBoxDefinition, SpriteBox
from shimmer.primitives import Point2d, Color
from shimmer.widgets.text_box import TextBoxDefinition, TextBox

ASSETS_PATH = Path(os.path.dirname(__file__)) / "assets"

Expand Down
119 changes: 90 additions & 29 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ pytest = "^5.3.1"
pytest-subtests = "^0.2.1"
mock = "^3.0.5"
pytest-mock = "^1.13.0"
coverage = "^4.5.4"
pytest-cov = "^2.8.1"

[tool.pytest]
mock_use_standalone_module = true

[build-system]
requires = ["poetry>=1.0.0"]
build-backend = "poetry.masonry.api"

3 changes: 2 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[pytest]
log_format = %(asctime)s.%(msecs)03d %(levelname)s %(message)s
log_format = %(asctime)s.%(msecs)03d %(filename)s:%(lineno)d %(levelname)s %(message)s
log_date_format = %Y-%m-%dT%H:%M:%S
log_cli = true
log_cli_level = 0
addopts = --cov=shimmer --cov-report html
Loading