me
/
guix
Archived
1
0
Fork 0

gnu: python-robotframework: Update to 5.0 and run acceptance tests.

* gnu/packages/python-xyz.scm (python-robotframework): Update to 5.0.
[patches]: Remove python-robotframework-ug2html.patch.  Add
python-robotframework-atest.patch and update
python-robotframework-source-date-epoch.patch.
[phases]: Use gexps.
{delete-problematic-tests}: New phase.
{check}: Also run `atest', the acceptance test suite.
[native-inputs]: Use new style.  Add python-lxml, python-pyyaml,
python-xmlschema, scrot and xvfb-run.
* gnu/packages/patches/python-robotframework-atest.patch: New file.
* gnu/packages/patches/python-robotframework-source-date-epoch.patch: Update patch.
* gnu/packages/patches/python-robotframework-ug2html.patch: Delete file.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.
master
Maxim Cournoyer 2022-03-24 14:46:37 -04:00
parent d1851d7880
commit d8f62653e5
No known key found for this signature in database
GPG Key ID: 1260E46482E63562
5 changed files with 256 additions and 126 deletions

View File

@ -1709,8 +1709,8 @@ dist_patch_DATA = \
%D%/packages/patches/python-pytorch-runpath.patch \
%D%/packages/patches/python-pytorch-system-libraries.patch \
%D%/packages/patches/python-pytorch-1.9.0-system-libraries.patch \
%D%/packages/patches/python-robotframework-atest.patch \
%D%/packages/patches/python-robotframework-source-date-epoch.patch \
%D%/packages/patches/python-robotframework-ug2html.patch \
%D%/packages/patches/python-robotframework-sshlibrary-rf5-compat.patch \
%D%/packages/patches/python-seaborn-kde-test.patch \
%D%/packages/patches/python-seaborn-2690.patch \

View File

@ -0,0 +1,61 @@
Patch submitted upstream: https://github.com/robotframework/robotframework/pull/4286.
diff --git a/atest/robot/standard_libraries/operating_system/modified_time.robot b/atest/robot/standard_libraries/operating_system/modified_time.robot
index d144ffd34..c7681e61d 100644
--- a/atest/robot/standard_libraries/operating_system/modified_time.robot
+++ b/atest/robot/standard_libraries/operating_system/modified_time.robot
@@ -8,7 +8,7 @@ ${TESTFILE} %{TEMPDIR}${/}robot-os-tests${/}f1.txt
*** Test Cases ***
Get Modified Time As Timestamp
${tc} = Check Test Case ${TESTNAME}
- Should Match Regexp ${tc.kws[0].msgs[0].message} Last modified time of '<a href=.*</a>' is 20\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d
+ Should Match Regexp ${tc.kws[0].msgs[0].message} Last modified time of '<a href=.*</a>' is \\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d
Get Modified Time As Seconds After Epoch
${tc} = Check Test Case ${TESTNAME}
diff --git a/atest/testdata/standard_libraries/builtin/get_time.robot b/atest/testdata/standard_libraries/builtin/get_time.robot
index 9847d8c42..24ce732ca 100644
--- a/atest/testdata/standard_libraries/builtin/get_time.robot
+++ b/atest/testdata/standard_libraries/builtin/get_time.robot
@@ -11,18 +11,18 @@ Get Time As Timestamp
Get Time As Seconds After Epoch
${time} = Get Time epoch
- Should Be True 1000000000 < ${time} < 2000000000
+ Should Be True 0 < ${time}
Get Time As Parts
@{time} = Get Time year, month, day, hour, min, sec
- Should Be True 2000 < ${time}[0] < 2100
+ Should Match Regexp ${time}[0] \\d{4}
Should Be True 1 <= int('${time}[1]') <= 12
Should Be True 1 <= int('${time}[2]') <= 31
Should Be True 0 <= int('${time}[3]') <= 23
Should Be True 0 <= int('${time}[4]') <= 59
Should Be True 0 <= int('${time}[5]') <= 59
${year} ${min} ${sec} = Get Time seconds and minutes and year and whatnot
- Should Be True 2000 < ${year} < 2100
+ Should Match Regexp ${year} \\d{4}
Should Be True 0 <= int('${min}') <= 59
Should Be True 0 <= int('${sec}') <= 59
diff --git a/atest/testdata/standard_libraries/operating_system/modified_time.robot b/atest/testdata/standard_libraries/operating_system/modified_time.robot
index 9489b3c9c..c712ebaed 100644
--- a/atest/testdata/standard_libraries/operating_system/modified_time.robot
+++ b/atest/testdata/standard_libraries/operating_system/modified_time.robot
@@ -14,13 +14,13 @@ Get Modified Time As Timestamp
Get Modified Time As Seconds After Epoch
${dirtime} = Get Modified Time ${CURDIR} epoch
- Should Be True 1000000000 < ${dirtime} < 2000000000
+ Should Be True ${dirtime} > 0
${current} = Get Time epoch
Should Be True ${current} >= ${dirtime}
Get Modified Time As Parts
${year} = Get Modified Time ${CURDIR} year
- Should Be True 2000 < ${year} < 2100
+ Should Match Regexp ${year} \\d{4}
${yyyy} ${mm} ${dd} = Get Modified Time ${CURDIR} year, month, day
Should Be Equal ${yyyy} ${year}
# Must use `int('x')` because otherwise 08 and 09 are considered octal

View File

@ -1,12 +1,64 @@
Do not embed any timestamp in the built documentation.
Upstream issue: https://github.com/robotframework/robotframework/issues/4262.
Patch submitted upstream: https://github.com/robotframework/robotframework/pull/4286.
diff --git a/BUILD.rst b/BUILD.rst
index 67902dd09..749c53fde 100644
--- a/BUILD.rst
+++ b/BUILD.rst
@@ -204,6 +204,9 @@ Creating distributions
7. Documentation
+ - For a reproducible build, set the ``SOURCE_DATE_EPOCH``
+ environment variable to 1.
+
- Generate library documentation::
invoke library-docs all
diff --git a/atest/robot/libdoc/html_output.robot b/atest/robot/libdoc/html_output.robot
index f42a4b150..af428c967 100644
--- a/atest/robot/libdoc/html_output.robot
+++ b/atest/robot/libdoc/html_output.robot
@@ -15,7 +15,7 @@ Version
Generated
[Template] Should Match Regexp
- ${MODEL}[generated] \\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}
+ ${MODEL}[generated] \\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}
Scope
${MODEL}[scope] GLOBAL
diff --git a/atest/robot/libdoc/json_output.robot b/atest/robot/libdoc/json_output.robot
index 78305a458..654603704 100644
--- a/atest/robot/libdoc/json_output.robot
+++ b/atest/robot/libdoc/json_output.robot
@@ -15,7 +15,7 @@ Version
Generated
[Template] Should Match Regexp
- ${MODEL}[generated] \\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}
+ ${MODEL}[generated] \\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}[+-]\\d{2}:\\d{2}
Scope
${MODEL}[scope] GLOBAL
diff --git a/atest/robot/libdoc/libdoc_resource.robot b/atest/robot/libdoc/libdoc_resource.robot
index bd7c10ecd..b7e06aacc 100644
--- a/atest/robot/libdoc/libdoc_resource.robot
+++ b/atest/robot/libdoc/libdoc_resource.robot
@@ -92,7 +92,8 @@ Lineno Should Be
Element Attribute Should Be ${LIBDOC} lineno ${lineno}
Generated Should Be Defined
- Element Attribute Should Match ${LIBDOC} generated ????-??-??T??:??:??Z
+ # For example, '1970-01-01T00:00:01+00:00'.
+ Element Attribute Should Match ${LIBDOC} generated ????-??-??T??:??:?????:??
Spec version should be correct
Element Attribute Should Be ${LIBDOC} specversion 4
diff --git a/doc/userguide/ug2html.py b/doc/userguide/ug2html.py
index 43cdb31bd..550e74a79 100755
index 033203552..b278c71c8 100755
--- a/doc/userguide/ug2html.py
+++ b/doc/userguide/ug2html.py
@@ -158,8 +158,7 @@ def create_userguide():
@@ -150,8 +150,7 @@ def create_userguide():
install_file = _copy_installation_instructions()
description = 'HTML generator for Robot Framework User Guide.'
@ -17,48 +69,97 @@ index 43cdb31bd..550e74a79 100755
'RobotFrameworkUserGuide.html']
os.chdir(CURDIR)
diff --git a/src/robot/libdocpkg/model.py b/src/robot/libdocpkg/model.py
index 4d9ffd70b..5c276d1d6 100644
index 5f44039ef..c36bf4a49 100644
--- a/src/robot/libdocpkg/model.py
+++ b/src/robot/libdocpkg/model.py
@@ -14,6 +14,7 @@
# limitations under the License.
@@ -19,7 +19,7 @@ from itertools import chain
import json
+import os
import re
from itertools import chain
from robot.model import Tags
from robot.running import ArgumentSpec
-from robot.utils import getshortdoc, get_timestamp, Sortable, setter
+from robot.utils import get_timestamp_for_doc, getshortdoc, Sortable, setter
@@ -113,7 +114,8 @@ class LibraryDoc(object):
from .htmlutils import DocFormatter, DocToHtml, HtmlToText
from .writer import LibdocWriter
@@ -113,7 +113,7 @@ class LibraryDoc:
'name': self.name,
'doc': self.doc,
'version': self.version,
- 'generated': get_timestamp(daysep='-', millissep=None),
+ 'generated': ('' if os.environ['SOURCE_DATE_EPOCH']
+ else get_timestamp(daysep='-', millissep=None)),
+ 'generated': get_timestamp_for_doc(),
'type': self.type,
'scope': self.scope,
'docFormat': self.doc_format,
diff --git a/src/robot/libdocpkg/xmlwriter.py b/src/robot/libdocpkg/xmlwriter.py
index 3882e1219..4a84fb42e 100644
index a765ebb2b..980debebb 100644
--- a/src/robot/libdocpkg/xmlwriter.py
+++ b/src/robot/libdocpkg/xmlwriter.py
@@ -14,6 +14,8 @@
@@ -13,9 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os.path
+import os
+
from datetime import datetime
-from datetime import datetime
-
-from robot.utils import XmlWriter
+from robot.utils import XmlWriter, get_timestamp_for_doc
from robot.utils import WINDOWS, XmlWriter, unicode
@@ -30,7 +32,9 @@ class LibdocXmlWriter(object):
class LibdocXmlWriter:
@@ -32,12 +30,11 @@ class LibdocXmlWriter:
self._write_end(writer)
def _write_start(self, libdoc, writer):
- generated = datetime.utcnow().replace(microsecond=0).isoformat() + 'Z'
+ generated = (
+ '' if os.environ['SOURCE_DATE_EPOCH']
+ else datetime.utcnow().replace(microsecond=0).isoformat() + 'Z')
attrs = {'name': libdoc.name,
'type': libdoc.type,
'format': libdoc.doc_format,
'scope': libdoc.scope,
- 'generated': generated,
+ 'generated': get_timestamp_for_doc(),
'specversion': '4'}
self._add_source_info(attrs, libdoc)
writer.start('keywordspec', attrs)
diff --git a/src/robot/utils/__init__.py b/src/robot/utils/__init__.py
index 442ffa4f3..80793ec29 100644
--- a/src/robot/utils/__init__.py
+++ b/src/robot/utils/__init__.py
@@ -58,9 +58,9 @@ from .robotinspect import is_init
from .robotio import binary_file_writer, create_destination_directory, file_writer
from .robotpath import abspath, find_file, get_link_path, normpath
from .robottime import (elapsed_time_to_string, format_time, get_elapsed_time,
- get_time, get_timestamp, secs_to_timestamp,
- secs_to_timestr, timestamp_to_secs, timestr_to_secs,
- parse_time)
+ get_time, get_timestamp, get_timestamp_for_doc,
+ secs_to_timestamp, secs_to_timestr, timestamp_to_secs,
+ timestr_to_secs, parse_time)
from .robottypes import (FALSE_STRINGS, TRUE_STRINGS, is_bytes, is_dict_like, is_falsy,
is_integer, is_list_like, is_number, is_pathlike, is_string,
is_truthy, is_union, type_name, type_repr, typeddict_types)
diff --git a/src/robot/utils/robottime.py b/src/robot/utils/robottime.py
index 97a7d1af0..4a0ba2d83 100644
--- a/src/robot/utils/robottime.py
+++ b/src/robot/utils/robottime.py
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import datetime
+import os
import re
import time
@@ -316,6 +318,13 @@ def get_timestamp(daysep='', daytimesep=' ', timesep=':', millissep='.'):
return TIMESTAMP_CACHE.get_timestamp(daysep, daytimesep, timesep, millissep)
+def get_timestamp_for_doc():
+ """Return a timestamp that honors `SOURCE_DATE_EPOCH`."""
+ ts = float(os.getenv('SOURCE_DATE_EPOCH', time.time()))
+ dt = datetime.datetime.fromtimestamp(round(ts), datetime.timezone.utc)
+ return dt.isoformat()
+
+
def timestamp_to_secs(timestamp, seps=None):
try:
secs = _timestamp_to_millis(timestamp, seps) / 1000.0

View File

@ -1,57 +0,0 @@
Do not require the obsolete robotframeworklexer.
Submitted upstream at: https://github.com/robotframework/robotframework/pull/4265.
diff --git a/doc/userguide/ug2html.py b/doc/userguide/ug2html.py
index 43cdb31bd..033203552 100755
--- a/doc/userguide/ug2html.py
+++ b/doc/userguide/ug2html.py
@@ -93,34 +93,26 @@ from docutils.parsers.rst import directives
from pygments import highlight, __version__ as pygments_version
from pygments.lexers import get_lexer_by_name
-# Use latest version, not version bundled with Pygments
-import robotframeworklexer
-
def too_old(version_string, minimum):
version = tuple(int(v) for v in version_string.split('.')[:2])
return version < minimum
-if too_old(getattr(robotframeworklexer, '__version__', '1.0'), (1, 1)):
- sys.exit('robotframeworklexer >= 1.1 is required.')
-if too_old(pygments_version, (2, 1)):
- sys.exit('Pygments >= 2.1 is required.')
+if too_old(pygments_version, (2, 8)):
+ sys.exit('Pygments >= 2.8 is required.')
def pygments_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
try:
- if arguments[0] == 'robotframework':
- lexer = robotframeworklexer.RobotFrameworkLexer()
- else:
- lexer = get_lexer_by_name(arguments[0])
+ lexer = get_lexer_by_name(arguments[0])
except ValueError as err:
raise ValueError(f'Invalid syntax highlighting language "{arguments[0]}".')
# take an arbitrary option if more than one is given
formatter = options and VARIANTS[options.keys()[0]] or DEFAULT
# possibility to read the content from an external file
- filtered = [ line for line in content if line.strip() ]
+ filtered = [line for line in content if line.strip()]
if len(filtered) == 1:
path = filtered[0].replace('/', os.sep)
if os.path.isfile(path):
diff --git a/requirements-build.txt b/requirements-build.txt
index e0f5e19a2..a2fcdcfd5 100644
--- a/requirements-build.txt
+++ b/requirements-build.txt
@@ -5,5 +5,4 @@ rellu >= 0.7
twine >= 1.12
wheel
docutils
-pygments >= 2.1
-robotframeworklexer >= 1.1
+pygments >= 2.8

View File

@ -4671,7 +4671,7 @@ ecosystem, but can naturally be used also by other projects.")
(define-public python-robotframework
(package
(name "python-robotframework")
(version "4.1.3")
(version "5.0")
;; There are no tests in the PyPI archive.
(source
(origin
@ -4681,55 +4681,80 @@ ecosystem, but can naturally be used also by other projects.")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "0j71awmfkwk7prz82kr1zbcl3nrih3396sshrygnqlrdjmgivd3p"))
(base32 "0qcm36c8hachbv3bc05ky7cf63i3sj0y8dw3bwjvcln28i543f81"))
(patches (search-patches
"python-robotframework-source-date-epoch.patch"
"python-robotframework-ug2html.patch"))))
"python-robotframework-atest.patch"
"python-robotframework-source-date-epoch.patch"))))
(build-system python-build-system)
(arguments
`(#:modules ((guix build python-build-system)
(list
#:modules '((guix build python-build-system)
(guix build utils)
(ice-9 ftw)
(ice-9 match)
(srfi srfi-26))
#:phases
(modify-phases %standard-phases
(add-before 'build 'build-and-install-doc
(lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc")
"/share/doc/robotframework")))
(invoke "invoke" "library-docs" "all")
(invoke "doc/userguide/ug2html.py" "dist") ;user guide
(mkdir-p doc)
(with-directory-excursion "dist"
(define user-guide-dir
(match (scandir "." (cut string-prefix?
"robotframework-userguide-" <>))
((dir) dir)
(_ (error "could not find the user guide directory"))))
(copy-recursively user-guide-dir doc)))))
(replace 'check
(lambda* (#:key native-inputs inputs tests?
#:allow-other-keys)
(when tests?
;; Some tests require timezone data. Otherwise, they
;; look up /etc/localtime, which doesn't exist, and
;; fail with:
;;
;; OverflowError: mktime argument out of range
(setenv "TZDIR"
(search-input-directory
(or native-inputs inputs) "share/zoneinfo"))
(setenv "TZ" "Europe/Paris")
(invoke "python" "utest/run.py")))))))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'delete-problematic-tests
(lambda _
;; Tests such as 'Tilde and username in path' rely on HOME and
;; USER being set, on top of the user's /etc/passwd home
;; directory not being '/', as is the case in the Guix build
;; container.
(delete-file "atest/robot/standard_libraries/\
operating_system/path_expansion.robot")
;; FIXME: The test 'Process.Sending Signal.By default signal
;; is not sent to process running in shell' fails for unknown
;; reason (see:
;; https://github.com/robotframework/robotframework/issues/4292).
(delete-file "atest/robot/standard_libraries/\
process/sending_signal.robot")))
(add-before 'build 'build-and-install-doc
(lambda* (#:key outputs #:allow-other-keys)
(let ((doc (string-append (assoc-ref outputs "doc")
"/share/doc/robotframework")))
(invoke "invoke" "library-docs" "all")
(invoke "doc/userguide/ug2html.py" "dist") ;user guide
(mkdir-p doc)
(with-directory-excursion "dist"
(define user-guide-dir
(match (scandir "." (cut string-prefix?
"robotframework-userguide-" <>))
((dir) dir)
(_ (error "could not find the user guide directory"))))
(copy-recursively user-guide-dir doc)))))
(replace 'check
(lambda* (#:key native-inputs inputs tests?
#:allow-other-keys)
(when tests?
;; Some tests require timezone data. Otherwise, they
;; look up /etc/localtime, which doesn't exist, and
;; fail with:
;;
;; OverflowError: mktime argument out of range
(setenv "TZDIR"
(search-input-directory
(or native-inputs inputs) "share/zoneinfo"))
(setenv "TZ" "Europe/Paris")
(format #t "Running unit tests...~%")
(invoke "utest/run.py")
(format #t "Running acceptance tests...~%")
(invoke "xvfb-run" "atest/run.py")))))))
(native-inputs
`(("python-docutils" ,python-docutils)
("python-jsonschema" ,python-jsonschema)
("python-invoke" ,python-invoke)
("python-pygments" ,python-pygments)
("python-rellu" ,python-rellu)
("python:tk" ,python "tk") ;used when building the HTML doc
("tzdata" ,tzdata-for-tests)))
(list python-docutils
python-jsonschema
python-invoke
python-lxml
python-pygments
python-pyyaml
python-rellu
`(,python "tk") ;used when building the HTML doc
python-xmlschema
scrot ;for taking screenshots
tzdata-for-tests
xvfb-run))
(outputs '("out" "doc"))
(home-page "https://robotframework.org")
(synopsis "Generic automation framework")