Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
54fcc75
Wrap 'make test' with 'xvfb-run'
elbenfreund Jul 8, 2017
975623e
Add inline comments
elbenfreund Jun 22, 2017
334753c
Add dedicated helper for fetching recent activities
elbenfreund Jun 22, 2017
4c5b85e
Add 'recent activities' to start-tracking view
elbenfreund Jun 22, 2017
5c17e7a
Sizing for recent activity widget
elbenfreund Jul 1, 2017
d941aab
Adjust existing tests
elbenfreund Jul 8, 2017
8593902
rename 'row_counter' parameter to 'row_index'
elbenfreund Sep 22, 2017
c08bd74
Fix typo
elbenfreund Sep 22, 2017
bec62d8
Change wording within preferences.
elbenfreund Sep 22, 2017
ddafbd1
fix ordering for 'get_recent_activities' helper
elbenfreund Sep 22, 2017
fa93742
Account for empty children when figuring out min_height
elbenfreund Sep 22, 2017
5b16ae9
Recent activities box uses last 24h
elbenfreund Sep 26, 2017
bd39965
Fix docstring
elbenfreund Sep 26, 2017
9ccdc80
Improve 'config' fixture
elbenfreund Sep 26, 2017
09aaac6
Fix 'app' fixture
elbenfreund Sep 26, 2017
95fc765
Fix test if 'HamsterGTK' instantiation
elbenfreund Sep 27, 2017
c0dd639
Rename 'tracking_recent_activities_items' to 'count'
elbenfreund Sep 27, 2017
2177d68
helpers: Refactor 'serialize_activity'
elbenfreund Nov 17, 2017
4b2819b
tracking: Improve categoryless fact serialization
elbenfreund May 4, 2018
90dbcc7
Fix typos
elbenfreund May 4, 2018
fa8057d
tracking: Add issue reference to ToDo comment
elbenfreund May 4, 2018
72af08c
helpers: Remove 'none_category' argument on serialize_activity
elbenfreund May 4, 2018
d685bf2
tests: Fix docker setup
elbenfreund May 4, 2018
c510594
Fix imports
elbenfreund May 6, 2018
1df269a
helpers: Add tests for 'serialize_activity'
elbenfreund May 6, 2018
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
7 changes: 2 additions & 5 deletions hamster_gtk/hamster_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,9 @@ def _write_config_to_file(self, configparser_instance):

def _get_config_from_file(self):
"""
Return a config dictionary from acp_instanceg file.
Return a config dictionary from app_instance file.

If there is none create a default config file. This methods main job is
to convert strings from the loaded ConfigParser File to appropiate
instances suitable for our config dictionary. The actual data retrival
is provided by a hamster-lib helper function.
If there is none create a default config file.

Returns:
dict: Dictionary of config key/values.
Expand Down
2 changes: 1 addition & 1 deletion hamster_gtk/tracking/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def get_start_button(activity):
self.attach(get_start_button(activity), 2, row_index, 1, 1)

today = datetime.date.today()
start = today - datetime.timedelta(90)
start = today - datetime.timedelta(1)
activities = helpers.get_recent_activities(self._controller, start, today)

row_index = 0
Expand Down
10 changes: 7 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,17 @@ def appdirs(request):

# Instances
@pytest.fixture
def app(request):
def app(request, config):
"""
Return an ``Application`` fixture.

Please note: the app has just been started but not activated.
"""
app = hamster_gtk.HamsterGTK()
def monkeypatched_reload_config(self):
return config
HamsterGTK = hamster_gtk.HamsterGTK
HamsterGTK._reload_config = monkeypatched_reload_config
app = HamsterGTK()
app._startup(app)
return app

Expand Down Expand Up @@ -104,7 +108,7 @@ def config(request, tmpdir):
'store': 'sqlalchemy',
'day_start': datetime.time(5, 30, 0),
'fact_min_delta': 1,
'tmpfile_path': tmpdir.join('tmpfile.hamster'),
'tmpfile_path': str(tmpdir.join('tmpfile.hamster')),
'db_engine': 'sqlite',
'db_path': ':memory:',
'autocomplete_activities_range': 30,
Expand Down
16 changes: 13 additions & 3 deletions tests/test_hamster-gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@
class TestHamsterGTK(object):
"""Unittests for the main app class."""

def test_instantiation(self):
"""Make sure class instatiation works as intended."""
app = hamster_gtk.HamsterGTK()
def test_instantiation(self, config):
"""
Make sure class instatiation works as intended.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instatiation → instantiation

We actually test against a monkeypatched class in order to avoid the
config loading machinery as this would access the user data on fs.
The relevant skiped methods need to be tested separately.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipped

"""
def monkeypatched_reload_config(self):
return config
HamsterGTK = hamster_gtk.HamsterGTK
HamsterGTK._reload_config = monkeypatched_reload_config
app = HamsterGTK()
assert app

def test__reload_config(self, app, config, mocker):
Expand Down