Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos
Commits
26d8b85a
Commit
26d8b85a
authored
Aug 31, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/cloudooo/test: port the tests to python3
parent
4590d41f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
25 deletions
+24
-25
software/cloudooo/test/setup.py
software/cloudooo/test/setup.py
+0
-1
software/cloudooo/test/test.py
software/cloudooo/test/test.py
+21
-23
software/slapos-sr-testing/software-py3.cfg
software/slapos-sr-testing/software-py3.cfg
+3
-0
software/slapos-sr-testing/software.cfg
software/slapos-sr-testing/software.cfg
+0
-1
No files found.
software/cloudooo/test/setup.py
View file @
26d8b85a
...
@@ -45,7 +45,6 @@ setup(name=name,
...
@@ -45,7 +45,6 @@ setup(name=name,
'slapos.cookbook'
,
'slapos.cookbook'
,
'slapos.libnetworkcache'
,
'slapos.libnetworkcache'
,
'requests'
,
'requests'
,
'six'
,
'PyPDF2'
,
'PyPDF2'
,
],
],
zip_safe
=
True
,
zip_safe
=
True
,
...
...
software/cloudooo/test/test.py
View file @
26d8b85a
##############################################################################
##############################################################################
# coding: utf-8
#
#
# Copyright (c) 2020 Nexedi SA and Contributors. All Rights Reserved.
# Copyright (c) 2020 Nexedi SA and Contributors. All Rights Reserved.
#
#
...
@@ -31,8 +30,8 @@ import csv
...
@@ -31,8 +30,8 @@ import csv
import
multiprocessing
import
multiprocessing
import
os
import
os
import
json
import
json
import
six.moves.xmlrpc_
client
as
xmlrpclib
import
xmlrpc.
client
as
xmlrpclib
import
six.moves.
urllib.parse
as
urllib_parse
import
urllib.parse
as
urllib_parse
import
ssl
import
ssl
import
base64
import
base64
import
io
import
io
...
@@ -63,6 +62,7 @@ class CloudOooTestCase(_CloudOooTestCase):
...
@@ -63,6 +62,7 @@ class CloudOooTestCase(_CloudOooTestCase):
context
=
ssl_context
,
context
=
ssl_context
,
allow_none
=
True
,
allow_none
=
True
,
)
)
self
.
addCleanup
(
self
.
server
(
'close'
))
def
normalizeFontName
(
font_name
):
def
normalizeFontName
(
font_name
):
...
@@ -111,16 +111,16 @@ class HTMLtoPDFConversionFontTestMixin:
...
@@ -111,16 +111,16 @@ class HTMLtoPDFConversionFontTestMixin:
def
test
(
self
):
def
test
(
self
):
actual_font_mapping_mapping
=
{}
actual_font_mapping_mapping
=
{}
for
font
in
self
.
expected_font_mapping
:
for
font
in
self
.
expected_font_mapping
:
src_html
=
'''
src_html
=
f
'''
<style>
<style>
p {{ font-family: "
{
font
}
"; font-size: 20pt; }}
p {{ font-family: "
{
font
}
"; font-size: 20pt; }}
</style>
</style>
<p>the quick brown fox jumps over the lazy dog.</p>
<p>the quick brown fox jumps over the lazy dog.</p>
<p>THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.</p>
<p>THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.</p>
'''
.
format
(
**
locals
())
'''
pdf_data
=
self
.
_convert_html_to_pdf
(
src_html
)
pdf_data
=
self
.
_convert_html_to_pdf
(
src_html
)
pdf_reader
=
PyPDF2
.
PdfFileReader
(
io
.
BytesIO
(
(
pdf_data
)
))
pdf_reader
=
PyPDF2
.
PdfFileReader
(
io
.
BytesIO
(
pdf_data
))
self
.
assertEqual
(
self
.
assertEqual
(
self
.
pdf_producer
,
self
.
pdf_producer
,
pdf_reader
.
getDocumentInfo
()[
'/Producer'
])
pdf_reader
.
getDocumentInfo
()[
'/Producer'
])
...
@@ -165,7 +165,7 @@ class TestWkhtmlToPDF(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
...
@@ -165,7 +165,7 @@ class TestWkhtmlToPDF(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
'Liberation Sans Narrow'
:
'LiberationSansNarrow'
,
'Liberation Sans Narrow'
:
'LiberationSansNarrow'
,
'Liberation Serif'
:
'LiberationSerif'
,
'Liberation Serif'
:
'LiberationSerif'
,
'Linux LibertineG'
:
'LiberationSans'
,
'Linux LibertineG'
:
'LiberationSans'
,
'OpenSymbol'
:
set
([
'DejaVuSans'
,
'OpenSymbol'
])
,
'OpenSymbol'
:
{
'DejaVuSans'
,
'OpenSymbol'
}
,
'Palatino'
:
'LiberationSans'
,
'Palatino'
:
'LiberationSans'
,
'Roboto Black'
:
'LiberationSans'
,
'Roboto Black'
:
'LiberationSans'
,
'Roboto Condensed Light'
:
'LiberationSans'
,
'Roboto Condensed Light'
:
'LiberationSans'
,
...
@@ -180,9 +180,9 @@ class TestWkhtmlToPDF(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
...
@@ -180,9 +180,9 @@ class TestWkhtmlToPDF(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
}
}
def
_convert_html_to_pdf
(
self
,
src_html
):
def
_convert_html_to_pdf
(
self
,
src_html
):
return
base64
.
decode
string
(
return
base64
.
decode
bytes
(
self
.
server
.
convertFile
(
self
.
server
.
convertFile
(
base64
.
encode
string
(
src_html
.
encode
()).
decode
(),
base64
.
encode
bytes
(
src_html
.
encode
()).
decode
(),
'html'
,
'html'
,
'pdf'
,
'pdf'
,
False
,
False
,
...
@@ -238,9 +238,9 @@ class TestLibreoffice(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
...
@@ -238,9 +238,9 @@ class TestLibreoffice(HTMLtoPDFConversionFontTestMixin, CloudOooTestCase):
}
}
def
_convert_html_to_pdf
(
self
,
src_html
):
def
_convert_html_to_pdf
(
self
,
src_html
):
return
base64
.
decode
string
(
return
base64
.
decode
bytes
(
self
.
server
.
convertFile
(
self
.
server
.
convertFile
(
base64
.
encode
string
(
src_html
.
encode
()).
decode
(),
base64
.
encode
bytes
(
src_html
.
encode
()).
decode
(),
'html'
,
'html'
,
'pdf'
,
'pdf'
,
).
encode
())
).
encode
())
...
@@ -251,10 +251,10 @@ class TestLibreOfficeTextConversion(CloudOooTestCase):
...
@@ -251,10 +251,10 @@ class TestLibreOfficeTextConversion(CloudOooTestCase):
def
test_html_to_text
(
self
):
def
test_html_to_text
(
self
):
self
.
assertEqual
(
self
.
assertEqual
(
base64
.
decode
string
(
base64
.
decode
bytes
(
self
.
server
.
convertFile
(
self
.
server
.
convertFile
(
base64
.
encode
string
(
base64
.
encode
bytes
(
u'<html>héhé</html>'
.
encode
(
'utf-8'
)).
decode
(),
'<html>héhé</html>'
.
encode
(
)).
decode
(),
'html'
,
'html'
,
'txt'
,
'txt'
,
).
encode
()),
).
encode
()),
...
@@ -274,19 +274,18 @@ class TestLibreOfficeCluster(CloudOooTestCase):
...
@@ -274,19 +274,18 @@ class TestLibreOfficeCluster(CloudOooTestCase):
global
_convert_html_to_text
global
_convert_html_to_text
def
_convert_html_to_text
(
src_html
):
def
_convert_html_to_text
(
src_html
):
return
base64
.
decode
string
(
return
base64
.
decode
bytes
(
self
.
server
.
convertFile
(
self
.
server
.
convertFile
(
base64
.
encode
string
(
src_html
.
encode
()).
decode
(),
base64
.
encode
bytes
(
src_html
.
encode
()).
decode
(),
'html'
,
'html'
,
'txt'
,
'txt'
,
).
encode
())
).
encode
())
pool
=
multiprocessing
.
Pool
(
5
)
pool
=
multiprocessing
.
Pool
(
5
)
# TODO py3: use with pool
with
pool
:
converted
=
pool
.
map
(
_convert_html_to_text
,
converted
=
pool
.
map
(
_convert_html_to_text
,
[
'<html><body>hello</body></html>'
]
*
100
)
[
'<html><body>hello</body></html>'
]
*
100
)
pool
.
terminate
()
pool
.
join
()
self
.
assertEqual
(
converted
,
[
codecs
.
BOM_UTF8
+
b'hello
\
n
'
]
*
100
)
self
.
assertEqual
(
converted
,
[
codecs
.
BOM_UTF8
+
b'hello
\
n
'
]
*
100
)
...
@@ -294,9 +293,8 @@ class TestLibreOfficeCluster(CloudOooTestCase):
...
@@ -294,9 +293,8 @@ class TestLibreOfficeCluster(CloudOooTestCase):
res
=
requests
.
get
(
res
=
requests
.
get
(
urllib_parse
.
urljoin
(
self
.
url
,
'/haproxy;csv'
),
urllib_parse
.
urljoin
(
self
.
url
,
'/haproxy;csv'
),
verify
=
False
,
verify
=
False
,
stream
=
True
,
)
)
reader
=
csv
.
DictReader
(
res
.
raw
)
reader
=
csv
.
DictReader
(
io
.
StringIO
(
res
.
text
)
)
line_list
=
list
(
reader
)
line_list
=
list
(
reader
)
# requests have been balanced
# requests have been balanced
total_hrsp_2xx
=
{
total_hrsp_2xx
=
{
...
...
software/slapos-sr-testing/software-py3.cfg
View file @
26d8b85a
...
@@ -42,3 +42,6 @@ extra =
...
@@ -42,3 +42,6 @@ extra =
seleniumserver ${slapos.test.seleniumserver-setup:setup}
seleniumserver ${slapos.test.seleniumserver-setup:setup}
theia ${slapos.test.theia-setup:setup}
theia ${slapos.test.theia-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
turnserver ${slapos.test.turnserver-setup:setup}
### WIP: python2 softwares tested with python3
cloudooo ${slapos.test.cloudooo-setup:setup}
software/slapos-sr-testing/software.cfg
View file @
26d8b85a
...
@@ -367,7 +367,6 @@ extra =
...
@@ -367,7 +367,6 @@ extra =
# You should not add more lines here.
# You should not add more lines here.
backupserver ${slapos.test.backupserver-setup:setup}
backupserver ${slapos.test.backupserver-setup:setup}
beremiz-ide ${slapos.test.beremiz-ide-setup:setup}
beremiz-ide ${slapos.test.beremiz-ide-setup:setup}
cloudooo ${slapos.test.cloudooo-setup:setup}
dream ${slapos.test.dream-setup:setup}
dream ${slapos.test.dream-setup:setup}
gitlab ${slapos.test.gitlab-setup:setup}
gitlab ${slapos.test.gitlab-setup:setup}
re6stnet ${slapos.test.re6stnet-setup:setup}
re6stnet ${slapos.test.re6stnet-setup:setup}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment