Skip to content

Commit

Permalink
Survey prompt. v1.3.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
tarpas committed Sep 27, 2022
1 parent 92be011 commit 6af65b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pytest-testmon
version = 1.3.6
version = 1.3.7
license = AGPL
author_email = [email protected]
author = Tibor Arpas, Tomas Matlovic, Daniel Hahler, Martin Racak
Expand Down
23 changes: 23 additions & 0 deletions testmon/pytest_testmon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from collections import defaultdict
from datetime import date, timedelta

import pytest
import pkg_resources
Expand All @@ -18,6 +19,8 @@
)
from testmon import configure

SURVEY_NOTIFICATION_INTERVAL = timedelta(days=28)


def pytest_addoption(parser):
group = parser.getgroup("testmon")
Expand Down Expand Up @@ -175,6 +178,26 @@ def pytest_report_header(config):
unstable_files,
)

show_survey_notification = True
last_notification_date = config.testmon_data.db._fetch_attribute(
"last_survey_notification_date"
)
if last_notification_date:
last_notification_date = date.fromisoformat(last_notification_date)
if date.today() - last_notification_date < SURVEY_NOTIFICATION_INTERVAL:
show_survey_notification = False
else:
config.testmon_data.db._write_attribute(
"last_survey_notification_date", date.today().isoformat()
)
else:
config.testmon_data.db._write_attribute(
"last_survey_notification_date", date.today().isoformat()
)

if show_survey_notification:
message += "\nWe'd like to hear from testmon users! Please go to https://testmon.org/survey to leave feedback."

return message


Expand Down

0 comments on commit 6af65b0

Please sign in to comment.