diff --git a/tests/test_elasticsearch.py b/tests/test_elasticsearch.py index 94c14fc..54ef10f 100644 --- a/tests/test_elasticsearch.py +++ b/tests/test_elasticsearch.py @@ -61,7 +61,6 @@ def _query_backend(self, name): class TestTimeExecution(BaseTestTimeExecutionElasticSearch): def test_time_execution(self): - count = 4 for i in range(count): @@ -110,7 +109,6 @@ def test_metadata(*args, **kwargs): @mock.patch("time_execution.backends.elasticsearch.logger") def test_error_warning(self, mocked_logger): - transport_error = TransportError("mocked error") es_index_error_ctx = mock.patch( "time_execution.backends.elasticsearch.Elasticsearch.index", @@ -132,7 +130,6 @@ def test_error_warning(self, mocked_logger): def test_with_origin(self): with settings(origin="unit_test"): - go() for metric in self._query_backend(go.get_fqn())["hits"]["hits"]: diff --git a/time_execution/backends/threaded.py b/time_execution/backends/threaded.py index fba071d..4b71b19 100644 --- a/time_execution/backends/threaded.py +++ b/time_execution/backends/threaded.py @@ -56,7 +56,8 @@ def __init__( self.start_worker() def write(self, name, **data): - data["timestamp"] = datetime.datetime.utcnow() + if "timestamp" not in data: + data["timestamp"] = datetime.datetime.utcnow() try: self._queue.put_nowait((name, data)) except Full: