From 8066699a58407501271860988874e0b6072faf7b Mon Sep 17 00:00:00 2001 From: Alexander Popel Date: Wed, 7 Oct 2026 10:21:00 +0300 Subject: [PATCH] Make missing property cloud tests more durable --- ci/setup-environment.ps1 | 8 +---- fiftyone_devicedetection/.pylintrc | 4 --- fiftyone_devicedetection_cloud/.pylintrc | 4 --- .../tests/test_cloud.py | 34 ++++++------------- fiftyone_devicedetection_examples/.pylintrc | 4 --- fiftyone_devicedetection_onpremise/.pylintrc | 4 --- fiftyone_devicedetection_shared/.pylintrc | 4 --- requirements.txt | 16 ++++++++- 8 files changed, 27 insertions(+), 51 deletions(-) diff --git a/ci/setup-environment.ps1 b/ci/setup-environment.ps1 index be4b1c6d2..b49d56c28 100644 --- a/ci/setup-environment.ps1 +++ b/ci/setup-environment.ps1 @@ -11,13 +11,7 @@ if ($env:GITHUB_JOB -eq "PreBuild") { exit 0 } -$dependencies = "-r", "$RepoName/requirements.txt", "wheel", ` - "tox", "pylint", "unittest-xml-reporting", "coverage", "certifi", ` - "requests", "cachetools", "chevron", "jsmin", ` - "fiftyone_pipeline_cloudrequestengine", ` - "fiftyone_pipeline_core", ` - "fiftyone_pipeline_engines", ` - "fiftyone_pipeline_engines_fiftyone" +$dependencies = "-r", "$RepoName/requirements.txt" ./python/setup-environment.ps1 -LanguageVersion $LanguageVersion -Dependencies $dependencies diff --git a/fiftyone_devicedetection/.pylintrc b/fiftyone_devicedetection/.pylintrc index 7f6ba63e4..9154c07d7 100644 --- a/fiftyone_devicedetection/.pylintrc +++ b/fiftyone_devicedetection/.pylintrc @@ -36,10 +36,6 @@ load-plugins= # Pickle collected data for later comparisons. persistent=yes -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no diff --git a/fiftyone_devicedetection_cloud/.pylintrc b/fiftyone_devicedetection_cloud/.pylintrc index 7f6ba63e4..9154c07d7 100644 --- a/fiftyone_devicedetection_cloud/.pylintrc +++ b/fiftyone_devicedetection_cloud/.pylintrc @@ -36,10 +36,6 @@ load-plugins= # Pickle collected data for later comparisons. persistent=yes -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no diff --git a/fiftyone_devicedetection_cloud/tests/test_cloud.py b/fiftyone_devicedetection_cloud/tests/test_cloud.py index 2a78291c9..9426eb0c5 100644 --- a/fiftyone_devicedetection_cloud/tests/test_cloud.py +++ b/fiftyone_devicedetection_cloud/tests/test_cloud.py @@ -22,7 +22,6 @@ import unittest import os -import re import time from fiftyone_devicedetection_cloud.devicedetection_cloud_pipelinebuilder import DeviceDetectionCloudPipelineBuilder @@ -116,18 +115,13 @@ def test_missing_property_service_element_not_found(self): fd.process() - result = "" - - try: + with self.assertRaises(Exception) as raised: fd.get("notpresent") - except Exception as e: - result = str(e) - - # The explainer URL may carry UTM query parameters; ignore them. - result = re.sub(r'\?utm_[^\s]*', '', result) - self.assertEqual( - result, "Your resource key does not include access to any properties under notpresent. For more details on resource keys, see our explainer: https://51degrees.com/documentation/_info__resource_keys.html Available element data keys are: ['device']") + result = str(raised.exception) + self.assertIn("notpresent", result) + self.assertIn("['device']", result) + self.assertIn("https://51degrees.com/documentation/_info__resource_keys.html", result) def test_engine_init_performance(self): """! @@ -171,20 +165,14 @@ def test_missing_property_service_not_found_anywhere(self): fd.process() - result = "" - - try: + with self.assertRaises(Exception) as raised: fd.device.get("notpresent") - except Exception as e: - result = str(e) - - self.maxDiff = None - - # The explainer URL may carry UTM query parameters; ignore them. - result = re.sub(r'\?utm_[^\s]*', '', result) - self.assertEqual( - result, "Property notpresent not found in data for element device. This is because your resource key does not include access to this property. Properties that are included for this key under device are " + ', '.join(list(pipeline.get_element("device").get_properties().keys())) + ". For more details on resource keys, see our explainer: https://51degrees.com/documentation/_info__resource_keys.html") + result = str(raised.exception) + self.assertIn("notpresent", result) + self.assertIn("device", result) + self.assertIn(', '.join(pipeline.get_element("device").get_properties().keys()), result) + self.assertIn("https://51degrees.com/documentation/_info__resource_keys.html", result) def test_cloud_request_origin(self): """! diff --git a/fiftyone_devicedetection_examples/.pylintrc b/fiftyone_devicedetection_examples/.pylintrc index 7f6ba63e4..9154c07d7 100644 --- a/fiftyone_devicedetection_examples/.pylintrc +++ b/fiftyone_devicedetection_examples/.pylintrc @@ -36,10 +36,6 @@ load-plugins= # Pickle collected data for later comparisons. persistent=yes -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no diff --git a/fiftyone_devicedetection_onpremise/.pylintrc b/fiftyone_devicedetection_onpremise/.pylintrc index 666d80038..627c1a0dc 100644 --- a/fiftyone_devicedetection_onpremise/.pylintrc +++ b/fiftyone_devicedetection_onpremise/.pylintrc @@ -36,10 +36,6 @@ load-plugins= # Pickle collected data for later comparisons. persistent=yes -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no diff --git a/fiftyone_devicedetection_shared/.pylintrc b/fiftyone_devicedetection_shared/.pylintrc index 7f6ba63e4..9154c07d7 100644 --- a/fiftyone_devicedetection_shared/.pylintrc +++ b/fiftyone_devicedetection_shared/.pylintrc @@ -36,10 +36,6 @@ load-plugins= # Pickle collected data for later comparisons. persistent=yes -# When enabled, pylint would attempt to guess common misconfiguration and emit -# user-friendly hints instead of false-positive error messages. -suggestion-mode=yes - # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no diff --git a/requirements.txt b/requirements.txt index 4cd6ce232..fa8afcc4d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,16 @@ cython -flask \ No newline at end of file +flask +wheel +tox +pylint +unittest-xml-reporting +coverage +certifi +requests +cachetools +chevron +jsmin +fiftyone_pipeline_cloudrequestengine +fiftyone_pipeline_core +fiftyone_pipeline_engines +fiftyone_pipeline_engines_fiftyone