Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

Commit 7ac6ea4

Browse files
authored
Merge pull request #27 from applitools/develop
Merge Develop to master
2 parents 7915b32 + 986fedc commit 7ac6ea4

File tree

9 files changed

+29
-35
lines changed

9 files changed

+29
-35
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 4.0.4
2+
current_version = 4.0.5
33
commit = True
44
tag = True
55

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.0.4"
1+
__version__ = "4.0.5"

eyes_common/applitools/common/config/configuration.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
import uuid
33
from copy import copy
44
from datetime import datetime
5-
from typing import Optional, Text
5+
from typing import Optional, Text, Union
66

77
import attr
8+
89
from applitools.common.geometry import RectangleSize
910
from applitools.common.match import ImageMatchSettings, MatchLevel
1011
from applitools.common.server import FailureReports, SessionType
11-
from applitools.common.utils import general_utils, argument_guard
12+
from applitools.common.utils import argument_guard, general_utils
1213
from applitools.common.utils.json_utils import JsonInclude
1314

1415
__all__ = ("BatchInfo", "Configuration")
@@ -28,28 +29,21 @@ class BatchInfo(object):
2829
factory=lambda: os.environ.get("APPLITOOLS_BATCH_NAME"),
2930
metadata={JsonInclude.THIS: True},
3031
) # type: Optional[Text]
32+
started_at = attr.ib(
33+
factory=lambda: datetime.now(general_utils.UTC),
34+
metadata={JsonInclude.THIS: True},
35+
) # type: Union[datetime, Text]
3136
sequence_name = attr.ib(
37+
init=False,
3238
factory=lambda: os.environ.get("APPLITOOLS_BATCH_SEQUENCE"),
3339
metadata={JsonInclude.NAME: "batchSequenceName"},
3440
) # type: Optional[Text]
35-
started_at = attr.ib(
36-
factory=lambda: datetime.now(general_utils.UTC),
37-
metadata={JsonInclude.THIS: True},
38-
) # # type: Text
3941
id = attr.ib(
42+
init=False,
4043
factory=lambda: os.environ.get("APPLITOOLS_BATCH_ID", str(uuid.uuid4())),
4144
metadata={JsonInclude.THIS: True},
4245
) # type: Text
4346

44-
@property
45-
def id_(self):
46-
# TODO: Remove in this way of initialization in future
47-
return self.id
48-
49-
@id_.setter
50-
def id_(self, value):
51-
self.id = value
52-
5347
def with_batch_id(self, id):
5448
argument_guard.not_none(id)
5549
self.id = id
@@ -94,7 +88,7 @@ class Configuration(object):
9488
save_failed_tests = attr.ib(default=False)
9589
fail_on_new_test = attr.ib(default=False)
9690
failure_reports = attr.ib(default=FailureReports.ON_CLOSE)
97-
send_dom = attr.ib(default=False)
91+
send_dom = attr.ib(default=True)
9892
use_dom = attr.ib(default=False)
9993
enable_patterns = attr.ib(default=False)
10094
default_match_settings = attr.ib(default=ImageMatchSettings())

eyes_common/applitools/common/utils/json_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def _filter(attr_, value):
101101

102102
def to_serializable(val):
103103
if isinstance(val, datetime):
104-
return val.isoformat() + "Z"
104+
return val.strftime("%Y-%m-%dT%H:%M:%SZ")
105105
elif isinstance(val, enum.Enum):
106106
return val.value
107107
elif attr.has(val.__class__):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.0.4"
1+
__version__ = "4.0.5"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.0.4"
1+
__version__ = "4.0.5"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "4.0.4"
1+
__version__ = "4.0.5"

tests/unit/eyes_common/test_batch_info.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ def test_create_batch_info(monkeypatch):
2828
assert bi.sequence_name == "sequence name"
2929

3030

31+
def test_batch_info_with_date():
32+
now = datetime.now()
33+
bi = BatchInfo(None, now)
34+
assert bi.started_at == now
35+
36+
3137
def test_create_batch_with_batch_id():
3238
bi = BatchInfo("My name").with_batch_id("custom id")
3339
assert bi.id == "custom id"
@@ -47,14 +53,3 @@ def test_set_env_params_in_batch_info():
4753
assert bi.name == "name"
4854
assert bi.id == "id"
4955
assert bi.sequence_name == "sequence name"
50-
51-
52-
def test_get_set_id_in_batch_info():
53-
bi = BatchInfo()
54-
bi.id = "id_1"
55-
assert bi.id == "id_1"
56-
57-
# backward compatibility
58-
bi.id_ = "id_2"
59-
assert bi.id == "id_2"
60-
assert bi.id_ == "id_2"

tests/unit/eyes_selenium/test_eyes.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import datetime
23

34
import pytest
45
from mock import patch
@@ -110,12 +111,16 @@ def test_baseline_env_name(eyes, driver_mock):
110111
assert session_info.baseline_env_name == "Baseline Env"
111112

112113

113-
def test_batch_info_sequence_name(eyes, driver_mock):
114-
eyes.batch = BatchInfo("Batch Info")
114+
def test_batch_info_serializing(eyes, driver_mock):
115+
date = datetime.datetime.strptime("2019-06-04T10:27:15Z", "%Y-%m-%dT%H:%M:%SZ")
116+
eyes.batch = BatchInfo("Batch Info", date)
115117
eyes.batch.sequence_name = "Sequence"
116118

117119
if not eyes._visual_grid_eyes:
118120
session_info = open_and_get_start_session_info(eyes, driver_mock)
119121
info_json = json_utils.to_json(session_info)
120122
batch_info = json.loads(info_json)["startInfo"]["batchInfo"]
123+
124+
assert batch_info["name"] == "Batch Info"
121125
assert batch_info["batchSequenceName"] == "Sequence"
126+
assert batch_info["startedAt"] == "2019-06-04T10:27:15Z"

0 commit comments

Comments
 (0)