anaynayak / buildnotify

A system tray based build status notification app for cctray.xml feeds.
https://anaynayak.github.io/buildnotify/
Other
29 stars 7 forks source link

Add an option to show the last build label #203

Closed Deuchnord closed 3 years ago

Deuchnord commented 3 years ago

Some CCTray servers (like gitlab-panorama) can show useful information in the XML lastBuildLabel attribute, such as a branch name. In this PR, I propose to add a way to display this information in the app menu. The display is disabled by default, and can be enabled on demand in the config window → Misc → show last build label for each project check box.

image

Deuchnord commented 3 years ago

@anaynayak I'm not sure to understand what's happening with the integration tests. Did I make something wrong?

anaynayak commented 3 years ago

Thanks for this wonderful pull request @Deuchnord . I'll try and have a look. I recently switched the provider to github actions so might be related.

anaynayak commented 3 years ago

It clearly isn't related to this PR. I'm trying to fix it here https://github.com/anaynayak/buildnotify/pull/204 . Will experiment with a few options.

anaynayak commented 3 years ago

I have ignored functional tests for now. Xvfb is installed and yet it seems to fail. For now if you rebase you should see the build pass. Locally running tox -e coverage will run all tests inclusive of the functional/ui ones.

Deuchnord commented 3 years ago

Tox command result:

================================================================ test session starts =================================================================
platform linux -- Python 3.9.1, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 -- /home/jerome/workspace/buildnotify/.tox/coverage/bin/python
cachedir: .tox/coverage/.pytest_cache
PyQt5 5.15.2 -- Qt runtime 5.15.2 -- Qt compiled 5.15.2
rootdir: /home/jerome/workspace/buildnotify, configfile: pytest.ini
plugins: requests-mock-1.8.0, xvfb-2.0.0, qt-3.3.0, pylint-0.18.0, mypy-0.8.0, mock-3.4.0, cov-2.10.1
collected 66 items                                                                                                                                   

test/http_connection_test.py::test_should_pass_auth_if_provided PASSED
test/http_connection_test.py::test_should_fetch_data_without_auth PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_build_tuples_by_server_url_and_name PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_identify_failing_builds PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_identify_fixed_builds PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_identify_new_builds PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_identify_still_failing_builds PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_identify_still_successful_builds PASSED
test/project_status_notification_test.py::ProjectStatusTest::test_should_include_prefix_in_notification PASSED
test/project_status_notification_test.py::test_should_return_notifications PASSED
test/project_test.py::ProjectTest::test_should_correctly_parse_project PASSED
test/project_test.py::ProjectTest::test_should_display_last_build_label_on_demand PASSED
test/project_test.py::ProjectTest::test_should_ignore_empty_last_build_time PASSED
test/project_test.py::ProjectTest::test_should_not_override_existing_url_scheme PASSED
test/project_test.py::ProjectTimezoneTest::test_should_consider_other_variants1 PASSED
test/project_test.py::ProjectTimezoneTest::test_should_consider_other_variants2 PASSED
test/project_test.py::ProjectTimezoneTest::test_should_consider_other_variants3 PASSED
test/project_test.py::ProjectTimezoneTest::test_should_override_timezone PASSED
test/project_test.py::ProjectTimezoneTest::test_should_retain_original_tz_offset PASSED
test/project_test.py::ProjectTimezoneTest::test_should_take_local_timezone_if_unspecified PASSED
test/projects_test.py::OverallIntegrationStatusTest::test_should_consolidate_build_status PASSED
test/projects_test.py::OverallIntegrationStatusTest::test_should_identify_failing_builds PASSED
test/projects_test.py::OverallIntegrationStatusTest::test_should_mark_failed_if_even_one_failed PASSED
test/projects_test.py::OverallIntegrationStatusTest::test_should_mark_failed_if_even_one_failed_across_servers PASSED
test/projects_test.py::ProjectLoaderTest::test_should_load_feed checking http://url
processed http://url
PASSED
test/projects_test.py::ProjectLoaderTest::test_should_respond_even_if_things_fail checking http://url
connect() takes 3 positional arguments but 4 were given
PASSED
test/projects_test.py::ProjectLoaderTest::test_should_set_display_prefix checking http://url
processed http://url
PASSED
test/response_test.py::ResponseTest::test_should_return_ssl_error PASSED
test/server_test.py::FilteredContinuousIntegrationServerTest::test_prefix_shouldnt_affect_exclusion PASSED
test/server_test.py::FilteredContinuousIntegrationServerTest::test_should_remove_excluded_projects PASSED
test/serverconfig_test.py::test_should_cleanup_url PASSED
test/version_test.py::test_should_cleanup_url PASSED
test/integration/app_menu_test.py::test_should_set_menu_items_for_projects PASSED
test/integration/app_menu_test.py::test_should_suffix_build_time PASSED
test/integration/app_menu_test.py::test_should_sort_by_name PASSED
test/integration/app_menu_test.py::test_should_add_display_prefix PASSED
test/integration/app_menu_test.py::test_should_consider_prefix_for_sorting PASSED
test/integration/app_menu_test.py::test_should_show_recent_build_first PASSED
test/integration/app_menu_test.py::test_should_show_preferences PASSED
test/integration/appui_test.py::test_should_update_tooltip_on_poll PASSED
test/integration/build_icons_test.py::test_should_consolidate_build_status PASSED
test/integration/build_icons_test.py::test_should_consolidate_build_status_with_failure_count PASSED
test/integration/buildnotify_test.py::test_should_consolidate_build_status PASSED
test/integration/config_test.py::ConfigTest::test_should_get_empty_if_missing PASSED
test/integration/config_test.py::ConfigTest::test_should_persist_empty_user_project_excludes PASSED
test/integration/config_test.py::ConfigTest::test_should_persist_user_project_excludes PASSED
test/integration/config_test.py::ConfigTest::test_should_return_all_servers PASSED
test/integration/config_test.py::ConfigTest::test_should_return_an_empty_list_if_unmapped PASSED
test/integration/config_test.py::ConfigTest::test_should_store_server_preferences PASSED
test/integration/config_test.py::ConfigTest::test_should_update_preferences PASSED
test/integration/preferences_dialog_test.py::test_should_show_configured_urls PASSED
test/integration/preferences_dialog_test.py::test_should_show_configure_notifications PASSED
test/integration/preferences_dialog_test.py::test_should_return_preferences_on_accept PASSED
test/integration/preferences_dialog_test.py::test_should_prefill_server_config PASSED
test/integration/preferences_dialog_test.py::test_should_remove_configured_servers PASSED
test/integration/projects_test.py::test_should_fetch_projects PASSED
test/integration/server_configuration_dialog_test.py::test_should_show_configured_urls checking http://localhost:8080/cc.xml
processed http://localhost:8080/cc.xml
PASSED
test/integration/server_configuration_dialog_test.py::test_should_save_restore_config checking http://localhost:8080/cc.xml
processed http://localhost:8080/cc.xml
PASSED
test/integration/server_configuration_dialog_test.py::test_should_exclude_projects checking http://localhost:8080/cc.xml
processed http://localhost:8080/cc.xml
PASSED
test/integration/server_configuration_dialog_test.py::test_should_preload_info checking http://localhost:8080/cc.xml
processed http://localhost:8080/cc.xml
PASSED
test/integration/server_configuration_dialog_test.py::test_should_fail_for_bad_url checking file:///badpath
No connection adapters were found for 'file:///badpath'
PASSED
test/integration/server_configuration_dialog_test.py::test_should_disable_authentication_if_keystore_is_unavailable PASSED
test/integration/timed_event_test.py::test_should_trigger_event_on_timeout PASSED
test/integration/timed_event_test.py::test_should_repeat_trigger_event PASSED
test/unit/distance_of_time_test.py::test_should_get_relative_distance PASSED
test/unit/distance_of_time_test.py::test_should_get_relative_distance_for_tz_unaware PASSED

================================================================== warnings summary ==================================================================
test/version_test.py:8
  /home/jerome/workspace/buildnotify/test/version_test.py:8: DeprecationWarning: invalid escape sequence \d
    assert match('^\d*.\d*.\d*$', version.version())

test/version_test.py:10
  /home/jerome/workspace/buildnotify/test/version_test.py:10: DeprecationWarning: invalid escape sequence \d
    assert match('^\d*.\d*.\d*.dev23$', version.version())

test/integration/appui_test.py:28
  /home/jerome/workspace/buildnotify/test/integration/appui_test.py:28: DeprecationWarning: invalid escape sequence \d
    assert re.compile("Last checked: \d{4}-\d\d-\d\d \d\d:\d\d:\d\d").match(str(widget.tray.toolTip())) is not None

-- Docs: https://docs.pytest.org/en/stable/warnings.html
---------------------------------- generated xml file: /home/jerome/workspace/buildnotify/reports/pytest/junit.xml -----------------------------------

----------- coverage: platform linux, python 3.9.1-final-0 -----------
Coverage XML written to file coverage.xml

=========================================================== 66 passed, 3 warnings in 1.02s ===========================================================
coverage run-test: commands[1] | flake8 /buildnotify
______________________________________________________________________ summary _______________________________________________________________________
  coverage: commands succeeded
  congratulations :)
anaynayak commented 3 years ago

Thanks for this @Deuchnord . Merging it.