Skip to content

Commit

Permalink
Adjust existing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elbenfreund committed Jul 8, 2017
1 parent a804ebe commit b41cbed
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,7 @@ def config(request, tmpdir):
'db_path': ':memory:',
'autocomplete_activities_range': 30,
'autocomplete_split_activity': False,
'tracking_show_recent_activities': True,
'tracking_recent_activities_items': 6,
}
return config
17 changes: 16 additions & 1 deletion tests/preferences/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,24 @@ def autocomplete_split_activity_parametrized(request):
return request.param


@pytest.fixture(params=(True, False))
def tracking_show_recent_activities_parametrized(request):
"""Return a parametrized tracking_show_recent_activities_parametrized value."""
return request.param


@pytest.fixture(params=(0, 1, 5, 15))
def tracking_recent_activities_items_parametrized(request):
"""Return a parametrized tracking_recent_activities_items_parametrized value."""
return request.param


@pytest.fixture
def config_parametrized(request, store_parametrized, day_start_parametrized,
fact_min_delta_parametrized, tmpfile_path_parametrized, db_engine_parametrized,
db_path_parametrized, autocomplete_activities_range_parametrized,
autocomplete_split_activity_parametrized):
autocomplete_split_activity_parametrized, tracking_show_recent_activities_parametrized,
tracking_recent_activities_items_parametrized):
"""Return a config fixture with heavily parametrized config values."""
return {
'store': store_parametrized,
Expand All @@ -95,6 +108,8 @@ def config_parametrized(request, store_parametrized, day_start_parametrized,
'db_path': db_path_parametrized,
'autocomplete_activities_range': autocomplete_activities_range_parametrized,
'autocomplete_split_activity': autocomplete_split_activity_parametrized,
'tracking_show_recent_activities': tracking_show_recent_activities_parametrized,
'tracking_recent_activities_items': tracking_recent_activities_items_parametrized,
}


Expand Down
4 changes: 3 additions & 1 deletion tests/preferences/test_preferences_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def test_init(self, dummy_window, app, config, empty_initial):
grids = result.get_content_area().get_children()[0].get_children()
# This assumes 2 children per config entry (label and widget).
grid_entry_counts = [len(g.get_children()) / 2 for g in grids]
assert sum(grid_entry_counts) == 8
assert sum(grid_entry_counts) == 10

@pytest.mark.slowtest
def test_get_config(self, preferences_dialog, config_parametrized):
"""
Make sure retrieval of field values works as expected.
Expand All @@ -32,6 +33,7 @@ def test_get_config(self, preferences_dialog, config_parametrized):
result = preferences_dialog.get_config()
assert result == config_parametrized

@pytest.mark.slowtest
def test_set_config(self, preferences_dialog, config_parametrized):
"""Make sure setting the field values works as expected."""
preferences_dialog._set_config(config_parametrized)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_hamster-gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test__reload_config(self, app, config, mocker):
def test__get_default_config(self, app, appdirs):
"""Make sure the defaults use appdirs for relevant paths."""
result = app._get_default_config()
assert len(result) == 8
assert len(result) == 10
assert os.path.dirname(result['tmpfile_path']) == appdirs.user_data_dir
assert os.path.dirname(result['db_path']) == appdirs.user_data_dir

Expand Down

0 comments on commit b41cbed

Please sign in to comment.