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

Commit 993143c

Browse files
authored
Release 4.0.8 (#41)
* Feature long request (#38) * feat: add to_rfc1123_datetime helper function; create datetime_utils * feat: add long_requests with check response * refactor: simplify request handling * refactor: use requests codes instead of numbers * refactor: simplify _long_request_loop mechanism * refactor: change `location` to capitalcase * test: update server_connector tests * test: add test for long_request * test: fix travis config * Fix full page screenshot in IE (#42) * refactor: EyesWebdriverScreenshot class simplification * test: add test_ie_viewport_screenshot * fix: ie always return full page screenshot If FPS cut it to VP size
1 parent 0eaa934 commit 993143c

File tree

13 files changed

+404
-265
lines changed

13 files changed

+404
-265
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
language: python
2+
services:
3+
- xvfb
24
install:
35
- pip install -U tox
46
before_script:
57
# Run GUI apps in headless mode
68
- export DISPLAY=:99.0
7-
- sh -e /etc/init.d/xvfb start
89
- sleep 10 # give webdriver some time to start
910
- export APPLITOOLS_BATCH_ID=`uuidgen -t`
1011
script:

eyes_common/applitools/common/config/configuration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from applitools.common.geometry import RectangleSize
1010
from applitools.common.match import ImageMatchSettings, MatchLevel
1111
from applitools.common.server import FailureReports, SessionType
12-
from applitools.common.utils import argument_guard, general_utils
12+
from applitools.common.utils import UTC, argument_guard
1313
from applitools.common.utils.json_utils import JsonInclude
1414

1515
__all__ = ("BatchInfo", "Configuration")
@@ -30,8 +30,7 @@ class BatchInfo(object):
3030
metadata={JsonInclude.THIS: True},
3131
) # type: Optional[Text]
3232
started_at = attr.ib(
33-
factory=lambda: datetime.now(general_utils.UTC),
34-
metadata={JsonInclude.THIS: True},
33+
factory=lambda: datetime.now(UTC), metadata={JsonInclude.THIS: True}
3534
) # type: Union[datetime, Text]
3635
sequence_name = attr.ib(
3736
init=False,

eyes_common/applitools/common/utils/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
urlsplit,
1212
urlunsplit,
1313
)
14+
from .datetime_utils import ( # type: ignore # noqa
15+
UTC,
16+
current_time_in_rfc1123,
17+
to_rfc1123_datetime,
18+
)
1419
from .general_utils import cached_property # noqa
1520

1621
__all__ = compat.__all__ + ("image_utils", "argument_guard") # noqa
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
from datetime import datetime, timedelta, tzinfo
2+
from typing import Text
3+
4+
__all__ = ("UTC", "to_rfc1123_datetime", "current_time_in_rfc1123")
5+
6+
7+
class _UtcTz(tzinfo):
8+
"""
9+
A UTC timezone class which is tzinfo compliant.
10+
"""
11+
12+
_ZERO = timedelta(0)
13+
14+
def utcoffset(self, dt):
15+
return _UtcTz._ZERO
16+
17+
def tzname(self, dt):
18+
return "UTC"
19+
20+
def dst(self, dt):
21+
return _UtcTz._ZERO
22+
23+
24+
UTC = _UtcTz()
25+
26+
27+
def to_rfc1123_datetime(dt):
28+
# type: (datetime) -> Text
29+
"""Return a string representation of a date according to RFC 1123
30+
(HTTP/1.1).
31+
32+
The supplied date must be in UTC.
33+
34+
"""
35+
weekday = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"][dt.weekday()]
36+
month = [
37+
"Jan",
38+
"Feb",
39+
"Mar",
40+
"Apr",
41+
"May",
42+
"Jun",
43+
"Jul",
44+
"Aug",
45+
"Sep",
46+
"Oct",
47+
"Nov",
48+
"Dec",
49+
][dt.month - 1]
50+
return "%s, %02d %s %04d %02d:%02d:%02d GMT" % (
51+
weekday,
52+
dt.day,
53+
month,
54+
dt.year,
55+
dt.hour,
56+
dt.minute,
57+
dt.second,
58+
)
59+
60+
61+
def current_time_in_rfc1123():
62+
# type: () -> Text
63+
return to_rfc1123_datetime(datetime.now(UTC))

eyes_common/applitools/common/utils/general_utils.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import itertools
55
import time
66
import typing
7-
from datetime import timedelta, tzinfo
87

98
from applitools.common import logger
109

@@ -21,27 +20,6 @@
2120
T = typing.TypeVar("T")
2221

2322

24-
class _UtcTz(tzinfo):
25-
"""
26-
A UTC timezone class which is tzinfo compliant.
27-
"""
28-
29-
_ZERO = timedelta(0)
30-
31-
def utcoffset(self, dt):
32-
return _UtcTz._ZERO
33-
34-
def tzname(self, dt):
35-
return "UTC"
36-
37-
def dst(self, dt):
38-
return _UtcTz._ZERO
39-
40-
41-
# Constant representing UTC
42-
UTC = _UtcTz()
43-
44-
4523
def use_default_if_none_factory(default_obj, obj):
4624
def default(attr_name):
4725
val = getattr(obj, attr_name)

0 commit comments

Comments
 (0)