1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

add test files to pre-commit hook and fix pep8 errors

This commit is contained in:
Hans-Christoph Steiner 2015-07-21 23:19:56 -07:00
parent 84c9777e9e
commit 9e5dd19fc8
4 changed files with 20 additions and 19 deletions

View File

@ -6,7 +6,7 @@
# Redirect output to stderr. # Redirect output to stderr.
exec 1>&2 exec 1>&2
PY_FILES="fdroid makebuildserver setup.py examples/*.py buildserver/*.py fdroidserver/*.py" PY_FILES="fdroid makebuildserver setup.py examples/*.py buildserver/*.py fdroidserver/*.py tests/*.TestCase"
SH_FILES="hooks/pre-commit" SH_FILES="hooks/pre-commit"
BASH_FILES="fd-commit jenkins-build docs/update.sh completion/bash-completion" BASH_FILES="fd-commit jenkins-build docs/update.sh completion/bash-completion"
RB_FILES="buildserver/cookbooks/*/recipes/*.rb" RB_FILES="buildserver/cookbooks/*/recipes/*.rb"

View File

@ -12,9 +12,8 @@ import sys
import tempfile import tempfile
import unittest import unittest
localmodule = os.path.realpath(os.path.join( localmodule = os.path.realpath(
os.path.dirname(inspect.getfile(inspect.currentframe())), os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
'..'))
print('localmodule: ' + localmodule) print('localmodule: ' + localmodule)
if localmodule not in sys.path: if localmodule not in sys.path:
sys.path.insert(0, localmodule) sys.path.insert(0, localmodule)
@ -22,6 +21,7 @@ if localmodule not in sys.path:
import fdroidserver.common import fdroidserver.common
import fdroidserver.metadata import fdroidserver.metadata
class CommonTest(unittest.TestCase): class CommonTest(unittest.TestCase):
'''fdroidserver/common.py''' '''fdroidserver/common.py'''
@ -67,7 +67,7 @@ class CommonTest(unittest.TestCase):
config = dict() config = dict()
config['sdk_path'] = os.getenv('ANDROID_HOME') config['sdk_path'] = os.getenv('ANDROID_HOME')
fdroidserver.common.config = config fdroidserver.common.config = config
self._set_build_tools(); self._set_build_tools()
config['aapt'] = fdroidserver.common.find_sdk_tools_cmd('aapt') config['aapt'] = fdroidserver.common.find_sdk_tools_cmd('aapt')
# these are set debuggable # these are set debuggable
testfiles = [] testfiles = []

View File

@ -9,9 +9,8 @@ import os
import sys import sys
import unittest import unittest
localmodule = os.path.realpath(os.path.join( localmodule = os.path.realpath(
os.path.dirname(inspect.getfile(inspect.currentframe())), os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
'..'))
print('localmodule: ' + localmodule) print('localmodule: ' + localmodule)
if localmodule not in sys.path: if localmodule not in sys.path:
sys.path.insert(0, localmodule) sys.path.insert(0, localmodule)
@ -19,6 +18,7 @@ if localmodule not in sys.path:
import fdroidserver.common import fdroidserver.common
import fdroidserver.install import fdroidserver.install
class InstallTest(unittest.TestCase): class InstallTest(unittest.TestCase):
'''fdroidserver/install.py''' '''fdroidserver/install.py'''

View File

@ -4,14 +4,14 @@
# http://www.drdobbs.com/testing/unit-testing-with-python/240165163 # http://www.drdobbs.com/testing/unit-testing-with-python/240165163
import inspect import inspect
import logging
import optparse import optparse
import os import os
import sys import sys
import unittest import unittest
localmodule = os.path.realpath(os.path.join( localmodule = os.path.realpath(
os.path.dirname(inspect.getfile(inspect.currentframe())), os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
'..'))
print('localmodule: ' + localmodule) print('localmodule: ' + localmodule)
if localmodule not in sys.path: if localmodule not in sys.path:
sys.path.insert(0, localmodule) sys.path.insert(0, localmodule)
@ -20,6 +20,7 @@ import fdroidserver.common
import fdroidserver.update import fdroidserver.update
from fdroidserver.common import FDroidPopen from fdroidserver.common import FDroidPopen
class UpdateTest(unittest.TestCase): class UpdateTest(unittest.TestCase):
'''fdroid update''' '''fdroid update'''