1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-04 02:00:11 +02:00
fdroidserver/tests
Hans-Christoph Steiner 2b6d692f06 use UTF8 as default instead of ASCII for .java .gradle pom.xml
.java .gradle and XML files all can use any encoding.  Most code is ASCII,
but authors' names, etc. can easily be non-ASCII.  UTF-8 is by far the most
common file encoding.  While UTF-8 is the default encoding inside the code
in Python 3, it still has to deal with the real world, so the encoding
needs to be explicitly set when reading and writing files. So this switches
fdroidserver to expect UTF-8 instead of ASCII when parsing these files. For
now, this commit means that we only support UTF-8 encoded *.java, pom.xml
or *.gradle files.  Ideally, the code would detect the encoding and use the
actual one, but that's a lot more work, and its something that will not
happen often. We can cross that bridge when we come to it.

One approach, which is taken in the commit when possible, is to keep the
data as `bytes`, in which case the encoding doesn't matter.

This also fixes this crash when parsing gradle and maven files with
non-ASCII chars:

ERROR: test_adapt_gradle (__main__.BuildTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/var/lib/jenkins/workspace/fdroidserver-eighthave/tests/build.TestCase", line 59, in test_adapt_gradle
    fdroidserver.build.adapt_gradle(testsdir)
  File "/var/lib/jenkins/workspace/fdroidserver-eighthave/fdroidserver/build.py", line 445, in adapt_gradle
    path)
  File "/var/lib/jenkins/workspace/fdroidserver-eighthave/fdroidserver/common.py", line 188, in regsub_file
    text = f.read()
  File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9460: ordinal not in range(128)
2016-06-07 20:13:54 +02:00
..
getsig include test cases for python getsig replacement 2014-11-07 09:20:33 +00:00
metadata standardize on .yml as the file extension for YAML 2016-03-23 17:16:28 +01:00
source-files build: improve regsub pattern for setting buildToolsVersion 2015-08-19 17:55:17 +02:00
build.TestCase use UTF8 as default instead of ASCII for .java .gradle pom.xml 2016-06-07 20:13:54 +02:00
common.TestCase refactor env handling for FDroidPopen to support .fdroid.* metadata 2016-03-23 17:16:27 +01:00
complete-ci-tests Prefer pyvenv instead of virtualenv for Python 3.3+ 2016-04-13 08:30:41 +02:00
description-parsing.py tests: switch to python3 2016-03-11 13:27:00 +00:00
import_proxy.py add a basic test of fdroid import 2015-09-10 11:08:40 +02:00
import.TestCase refactor env handling for FDroidPopen to support .fdroid.* metadata 2016-03-23 17:16:27 +01:00
install.TestCase refactor env handling for FDroidPopen to support .fdroid.* metadata 2016-03-23 17:16:27 +01:00
metadata.TestCase standardize on .yml as the file extension for YAML 2016-03-23 17:16:28 +01:00
run-tests standardize on .yml as the file extension for YAML 2016-03-23 17:16:28 +01:00
update.TestCase refactor env handling for FDroidPopen to support .fdroid.* metadata 2016-03-23 17:16:27 +01:00
urzip-badcert.apk include test cases for python getsig replacement 2014-11-07 09:20:33 +00:00
urzip-badsig.apk include test cases for python getsig replacement 2014-11-07 09:20:33 +00:00
urzip-release-unsigned.apk added test case for common.isApkDebuggable() 2014-12-14 13:25:20 +01:00
urzip-release.apk added test case for common.isApkDebuggable() 2014-12-14 13:25:20 +01:00
urzip.apk tests: try fdroid update after adding an APK to an existing repo 2014-06-04 21:54:55 -04:00