[PATCH] Add contrib scripts and relevant documentation
by Arun Babu Neelicattu
From: Arun Babu Neelicattu <abn(a)redhat.com>
---
.gitignore | 3 +++
HACKING | 47 +++++++++++++++++++++++++++++++------
contrib/activate-dev-env | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
contrib/run-tests | 21 +++++++++++++++++
setup.py | 2 +-
5 files changed, 125 insertions(+), 8 deletions(-)
create mode 100644 contrib/activate-dev-env
create mode 100755 contrib/run-tests
diff --git a/.gitignore b/.gitignore
index 7608296..8aceef6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,6 @@ MANIFEST
dist
build
.coverage
+
+#python-bugzilla venvs
+dev-env*
diff --git a/HACKING b/HACKING
index d269b33..54b77c0 100644
--- a/HACKING
+++ b/HACKING
@@ -1,23 +1,56 @@
-If submitting any patch, please verify that no new pylint or pep8 violations
-are introduced:
+Hackers Guide
+=============
- python setup.py pylint
+1. Setting up the environment
+-----------------------------
+To start development, you can set-up/activate a virtual environment by using the
+following command:
+ source contrib/activate-dev-env [python2|python3]
-And ensure that the basic unit test suite does not regress
+Note: Providing no arguments will attempt to use python2.
- python setup.py test
+# Manually activating an environment
+ source dev-env-${NAME}/bin/activate
+2. Running tests
+----------------
+Once you have already activated an environment, you can use the following.
+
+# Basic unit test suite
+ python setup.py test
+
+# Functional tests
There are more comprehensive tests that are disabled by default. Readonly
functional tests that run against several public bugzilla instances. No
login account is required:
- python setup.py test --ro-functional
+ python setup.py test --ro-functional
And read/write functional tests. These currently run against the test
bugzilla instance at partner-bugzilla.redhat.com, and requires a valid
login there:
- python setup.py test --rw-functional
+ python setup.py test --rw-functional
+
+Note: Before running rw-functional tests, make sure you have logged using:
+ python bugzilla-cli \
+ --bugzilla="https://partner-bugzilla.redhat.com/xmlrpc.cgi" \
+ --user=$USER login
+
+3. pylint and pep8
+------------------
+To test for pylint or pep8 violations, you can run:
+ python setup.py pylint
+
+Note: This expects that you already have pylint and pep8 (installed when setting
+up virtualenv) isntalled.
+
+4. Patch Submission
+-------------------
+If you are submitting a patch, ensure the following:
+ [REQ] verify that no new pylint or pep8 violations
+ [REQ] run basic unit test suite across all python versions:
+ bash contrib/run-tests
Running any of the functional tests is not a requirement for patch submission,
but please give them a go if you are interested.
diff --git a/contrib/activate-dev-env b/contrib/activate-dev-env
new file mode 100644
index 0000000..5fcd430
--- /dev/null
+++ b/contrib/activate-dev-env
@@ -0,0 +1,60 @@
+# Helper script to create (if required) and activate a virtual environment for
+# a specified PYTHON_BINARY (python|python2|python3) and install dependencies
+# required for testing and development.
+#
+# Usage: source $0 [PYTHON_BINARY]
+
+# use env python by default
+PYTHON_BIN=python2
+VIRTIALENV_CMD=virtualenv
+SETUP_PY="setup.py"
+DEV_MODULE_DIR="bugzilla"
+DIR_PREFIX="dev-env"
+
+if [ $# -ne 0 ]; then
+ PYTHON_BIN=$1
+fi
+
+function activate()
+{
+ DIR_NAME=$1
+ echo "INFO: Activating virtualenv at ${DIR_NAME}"
+ source ${DIR_NAME}/bin/activate
+}
+
+function virtualize()
+{
+ PROMPT=$(basename ${PYTHON_BIN})
+ DIR_NAME="${DIR_PREFIX}-${PROMPT}"
+
+ if [ ! -d ${DIR_NAME} ]; then
+ echo "INFO: Creating virtualenv ${DIR_NAME}"
+ ${VIRTIALENV_CMD} -p $(which ${PYTHON_BIN}) --prompt "${PROMPT}" ${DIR_NAME}
+ fi
+
+ if [ -d ${DIR_NAME} ]; then
+ activate $DIR_NAME
+
+ for REQ in $(find ./ -maxdepth 1 -type f -name "*requirements.txt"); do
+ pip install -qr "${REQ}"
+ done
+ else
+ echo >&2 "ERROR: Failed to activate virtualenv."
+ fi
+}
+
+
+if ! command -v ${VIRTIALENV_CMD} >/dev/null 2>&1; then
+ # We require virtuaenv to be available
+ echo >&2 "ERROR: virtualenv command not found"
+elif ! command -v $PYTHON_BIN >/dev/null 2>&1; then
+ # Ensure PYTHON_BIN is valid
+ echo >&2 "ERROR: ${PYTHON_BIN} command not found"
+elif ! ${PYTHON_BIN} --version 2>&1 | grep -q '^Python'; then
+ # Ensure PYTHON_BIN is python
+ echo >&2 "ERROR: '${PYTHON_BIN} --version' returned an invalid response. Is ${PYTHON_BIN} really python?"
+elif [ ! -f ${SETUP_PY} ]; then
+ echo >&2 "ERROR: ${SETUP_PY} not found"
+else
+ virtualize
+fi
diff --git a/contrib/run-tests b/contrib/run-tests
new file mode 100755
index 0000000..644f5d9
--- /dev/null
+++ b/contrib/run-tests
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# Helper script to run test for each supported python versions
+# Defaults to running basic tests. The script activates the correct environment
+# as required.
+
+# Usage: $0 [options]
+# Example: $0 --ro-functional
+
+ARGS="$@"
+
+for BIN in python2 python3; do
+ if command -v ${BIN} >/dev/null 2>&1; then
+ echo "INFO: Running tests for ${BIN}"
+ . ./contrib/activate-dev-env ${BIN}
+ python setup.py test ${ARGS}
+ echo "INFO: Tests completed for ${BIN}"
+ else
+ echo "INFO: ${BIN} not found, skipping tests."
+ fi
+done
diff --git a/setup.py b/setup.py
index 415eee0..6abd9b0 100755
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,7 @@ class TestCommand(Command):
usecov = False
if usecov:
- cov = coverage.coverage(omit=["/*/tests/*", "/usr/*"])
+ cov = coverage.coverage(omit=["/*/tests/*", "/usr/*", "*dev-env*"])
cov.erase()
cov.start()
--
1.8.3.1
10 years, 4 months
[PATCH 01/13] Add *requirement.txt files
by Arun Babu Neelicattu
From: Arun Babu Neelicattu <abn(a)redhat.com>
---
requirements.txt | 1 +
test-requirements.txt | 3 +++
2 files changed, 4 insertions(+)
create mode 100644 requirements.txt
create mode 100644 test-requirements.txt
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..d4ba5cd
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1 @@
+pycurl
diff --git a/test-requirements.txt b/test-requirements.txt
new file mode 100644
index 0000000..f45fca2
--- /dev/null
+++ b/test-requirements.txt
@@ -0,0 +1,3 @@
+# additional packages needed for testing
+coverage
+pep8
--
1.8.3.1
10 years, 5 months
[PATCH] Add contrib scripts and relevant documentation
by Arun Babu Neelicattu
From: Arun Babu Neelicattu <abn(a)redhat.com>
---
.gitignore | 3 +++
HACKING | 48 ++++++++++++++++++++++++++++++++------
contrib/activate-dev-env | 60 ++++++++++++++++++++++++++++++++++++++++++++++++
contrib/run-tests | 21 +++++++++++++++++
setup.py | 2 +-
5 files changed, 126 insertions(+), 8 deletions(-)
create mode 100644 contrib/activate-dev-env
create mode 100755 contrib/run-tests
diff --git a/.gitignore b/.gitignore
index 7608296..8aceef6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,6 @@ MANIFEST
dist
build
.coverage
+
+#python-bugzilla venvs
+dev-env*
diff --git a/HACKING b/HACKING
index d269b33..53c4ea2 100644
--- a/HACKING
+++ b/HACKING
@@ -1,23 +1,57 @@
-If submitting any patch, please verify that no new pylint or pep8 violations
-are introduced:
+Hackers Guide
+=============
- python setup.py pylint
+1. Setting up the environment
+-----------------------------
+To start development, you can set-up/activate a virtual environment by using the
+following command:
+ source contrib/activate-dev-env
-And ensure that the basic unit test suite does not regress
+Note: This will attempt to install pycurl, this requires libcurl to be available
+on your system.
- python setup.py test
+# Manually activating an environment
+ source dev-env-${NAME}/bin/activate
+2. Running tests
+----------------
+Once you have already activated an environment, you can use the following.
+
+# Basic unit test suite
+ python setup.py test
+
+# Functional tests
There are more comprehensive tests that are disabled by default. Readonly
functional tests that run against several public bugzilla instances. No
login account is required:
- python setup.py test --ro-functional
+ python setup.py test --ro-functional
And read/write functional tests. These currently run against the test
bugzilla instance at partner-bugzilla.redhat.com, and requires a valid
login there:
- python setup.py test --rw-functional
+ python setup.py test --rw-functional
+
+Note: Before running rw-functional tests, make sure you have logged using:
+ python bugzilla-cli \
+ --bugzilla="https://partner-bugzilla.redhat.com/xmlrpc.cgi" \
+ --user=$USER login
+
+3. pylint and pep8
+------------------
+To test for pylint or pep8 violations, you can run:
+ python setup.py pylint
+
+Note: This expects that you already have pylint and pep8 (installed when setting
+up virtualenv) isntalled.
+
+4. Patch Submission
+-------------------
+If you are submitting a patch, ensure the following:
+ [REQ] verify that no new pylint or pep8 violations
+ [REQ] run basic unit test suite across all python versions:
+ bash contrib/run-tests
Running any of the functional tests is not a requirement for patch submission,
but please give them a go if you are interested.
diff --git a/contrib/activate-dev-env b/contrib/activate-dev-env
new file mode 100644
index 0000000..5fcd430
--- /dev/null
+++ b/contrib/activate-dev-env
@@ -0,0 +1,60 @@
+# Helper script to create (if required) and activate a virtual environment for
+# a specified PYTHON_BINARY (python|python2|python3) and install dependencies
+# required for testing and development.
+#
+# Usage: source $0 [PYTHON_BINARY]
+
+# use env python by default
+PYTHON_BIN=python2
+VIRTIALENV_CMD=virtualenv
+SETUP_PY="setup.py"
+DEV_MODULE_DIR="bugzilla"
+DIR_PREFIX="dev-env"
+
+if [ $# -ne 0 ]; then
+ PYTHON_BIN=$1
+fi
+
+function activate()
+{
+ DIR_NAME=$1
+ echo "INFO: Activating virtualenv at ${DIR_NAME}"
+ source ${DIR_NAME}/bin/activate
+}
+
+function virtualize()
+{
+ PROMPT=$(basename ${PYTHON_BIN})
+ DIR_NAME="${DIR_PREFIX}-${PROMPT}"
+
+ if [ ! -d ${DIR_NAME} ]; then
+ echo "INFO: Creating virtualenv ${DIR_NAME}"
+ ${VIRTIALENV_CMD} -p $(which ${PYTHON_BIN}) --prompt "${PROMPT}" ${DIR_NAME}
+ fi
+
+ if [ -d ${DIR_NAME} ]; then
+ activate $DIR_NAME
+
+ for REQ in $(find ./ -maxdepth 1 -type f -name "*requirements.txt"); do
+ pip install -qr "${REQ}"
+ done
+ else
+ echo >&2 "ERROR: Failed to activate virtualenv."
+ fi
+}
+
+
+if ! command -v ${VIRTIALENV_CMD} >/dev/null 2>&1; then
+ # We require virtuaenv to be available
+ echo >&2 "ERROR: virtualenv command not found"
+elif ! command -v $PYTHON_BIN >/dev/null 2>&1; then
+ # Ensure PYTHON_BIN is valid
+ echo >&2 "ERROR: ${PYTHON_BIN} command not found"
+elif ! ${PYTHON_BIN} --version 2>&1 | grep -q '^Python'; then
+ # Ensure PYTHON_BIN is python
+ echo >&2 "ERROR: '${PYTHON_BIN} --version' returned an invalid response. Is ${PYTHON_BIN} really python?"
+elif [ ! -f ${SETUP_PY} ]; then
+ echo >&2 "ERROR: ${SETUP_PY} not found"
+else
+ virtualize
+fi
diff --git a/contrib/run-tests b/contrib/run-tests
new file mode 100755
index 0000000..644f5d9
--- /dev/null
+++ b/contrib/run-tests
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+# Helper script to run test for each supported python versions
+# Defaults to running basic tests. The script activates the correct environment
+# as required.
+
+# Usage: $0 [options]
+# Example: $0 --ro-functional
+
+ARGS="$@"
+
+for BIN in python2 python3; do
+ if command -v ${BIN} >/dev/null 2>&1; then
+ echo "INFO: Running tests for ${BIN}"
+ . ./contrib/activate-dev-env ${BIN}
+ python setup.py test ${ARGS}
+ echo "INFO: Tests completed for ${BIN}"
+ else
+ echo "INFO: ${BIN} not found, skipping tests."
+ fi
+done
diff --git a/setup.py b/setup.py
index 415eee0..6abd9b0 100755
--- a/setup.py
+++ b/setup.py
@@ -49,7 +49,7 @@ class TestCommand(Command):
usecov = False
if usecov:
- cov = coverage.coverage(omit=["/*/tests/*", "/usr/*"])
+ cov = coverage.coverage(omit=["/*/tests/*", "/usr/*", "*dev-env*"])
cov.erase()
cov.start()
--
1.8.3.1
10 years, 5 months
Remove dependency on logilab
by Arun Babu Neelicattu
Hi,
Current implementation relies on logilab.optik_ext.ManHelpFormatter for man page generation. Can we remove this dependency by copying over what we need?
The main reason for asking this is because this stalls the completion of python3 porting work. The current version of logilab-common [1] does not seem to install cleanly when using python3.
I have attached the the code derived from [2], can we use this or something similar instead of relying on logilab being present in the build environment? Furthermore, should the man page generation be re-factored out of bin/bugzilla? It seems that this is only relevant only in the context of installation and/or rpm packaging. Am I missing something obvious here?
The other option is to skip generation all together if running under python3.
Regards,
Arun
[1] https://pypi.python.org/pypi/logilab-common
[2] http://www.logilab.org/versionedfile/10738
--
Arun Neelicattu / Red Hat Security Response Team
PGP: 0xC244393B 5229 F596 474F 00A1 E416 CF8B 36F5 5054 C244 393B
10 years, 5 months
[PATCH 1/4] Make print statements forward compatibile with python3
by Arun Babu Neelicattu
From: Arun Babu Neelicattu <abn(a)redhat.com>
---
bin/bugzilla | 46 ++++++++++++++++++++++++----------------------
bugzilla/bug.py | 2 +-
setup.py | 12 +++++++-----
tests/__init__.py | 6 ++++--
tests/misc.py | 6 ++++--
tests/rw_functional.py | 10 ++++++----
6 files changed, 46 insertions(+), 36 deletions(-)
diff --git a/bin/bugzilla b/bin/bugzilla
index fa5314b..980970d 100755
--- a/bin/bugzilla
+++ b/bin/bugzilla
@@ -11,6 +11,8 @@
# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
# the full text of the license.
+from __future__ import print_function
+
import getpass
import locale
import logging
@@ -515,7 +517,7 @@ https://fedorahosted.org/mailman/listinfo/python-bugzilla
http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
https://bugzilla.redhat.com/docs/en/html/api/Bugzilla/WebService/Bug.html'''
- print manpage
+ print(manpage)
def _do_query(bz, opt, parser):
@@ -653,11 +655,11 @@ def _do_info(bz, opt):
if opt.products:
for name in sorted([p["name"] for p in products]):
- print name
+ print(name)
if opt.components:
for name in sorted(bz.getcomponents(opt.components)):
- print name
+ print(name)
if opt.component_owners:
# Looking up this info for rhbz 'Fedora' product is sloooow
@@ -672,8 +674,8 @@ def _do_info(bz, opt):
component_details = bz.getcomponentsdetails(opt.component_owners)
for c in sorted(component_details):
- print to_encoding(u"%s: %s" %
- (c, component_details[c]['initialowner']))
+ print(to_encoding(u"%s: %s" %
+ (c, component_details[c]['initialowner'])))
if opt.versions:
for p in products:
@@ -681,7 +683,7 @@ def _do_info(bz, opt):
continue
if "versions" in p:
for v in p['versions']:
- print to_encoding(v["name"])
+ print(to_encoding(v["name"]))
break
@@ -723,12 +725,12 @@ def _format_output(bz, opt, buglist):
if opt.output == 'raw':
buglist = bz.getbugs([b.bug_id for b in buglist])
for b in buglist:
- print "Bugzilla %s: " % b.bug_id
+ print("Bugzilla %s: " % b.bug_id)
for a in dir(b):
if a.startswith("__") and a.endswith("__"):
continue
- print to_encoding(u"ATTRIBUTE[%s]: %s" % (a, getattr(b, a)))
- print "\n\n"
+ print(to_encoding(u"ATTRIBUTE[%s]: %s" % (a, getattr(b, a))))
+ print("\n\n")
return
def bug_field(matchobj):
@@ -779,7 +781,7 @@ def _format_output(bz, opt, buglist):
return to_encoding(val)
for b in buglist:
- print format_field_re.sub(bug_field, opt.outputformat)
+ print(format_field_re.sub(bug_field, opt.outputformat))
def _parse_triset(vallist, checkplus=True, checkminus=True, checkequal=True,
@@ -969,7 +971,7 @@ def _do_get_attach(bz, opt, parser, args):
while data:
outfile.write(data)
data = att.read(4096)
- print "Wrote %s" % outfile.name
+ print("Wrote %s" % outfile.name)
return
@@ -1008,7 +1010,7 @@ def _do_set_attach(bz, opt, parser, args):
# Upload attachments
for bugid in args:
attid = bz.attachfile(bugid, fileobj, desc, **kwargs)
- print "Created attachment %i on bug %s" % (attid, bugid)
+ print("Created attachment %i on bug %s" % (attid, bugid))
#################
@@ -1080,10 +1082,10 @@ def main(bzinstance=None):
sys.stdout.write('Logging in... ')
sys.stdout.flush()
if bz.login(global_opt.user, global_opt.password):
- print 'Authorization cookie received.'
+ print('Authorization cookie received.')
sys.exit(0)
else:
- print 'failed.'
+ print('failed.')
sys.exit(1)
# Set up authentication
@@ -1162,32 +1164,32 @@ if __name__ == '__main__':
main()
except KeyboardInterrupt:
log.debug("", exc_info=True)
- print "\nExited at user request."
+ print("\nExited at user request.")
sys.exit(1)
except socket.error, e:
log.debug("", exc_info=True)
- print "\nConnection lost/failed: %s" % str(e)
+ print("\nConnection lost/failed: %s" % str(e))
sys.exit(2)
except (xmlrpclib.Fault, urllib2.HTTPError), e:
log.debug("", exc_info=True)
- print "\nServer error: %s" % str(e)
+ print("\nServer error: %s" % str(e))
sys.exit(3)
except xmlrpclib.ProtocolError, e:
log.debug("", exc_info=True)
- print "\nInvalid server response: %d %s" % (e.errcode, e.errmsg)
+ print("\nInvalid server response: %d %s" % (e.errcode, e.errmsg))
# Give SSL recommendations
import pycurl
sslerrcodes = [getattr(pycurl, ename) for ename in dir(pycurl) if
ename.startswith("E_SSL")]
if e.errcode in sslerrcodes:
- print ("\nIf you trust the remote server, you can work "
- "around this error with:\n"
+ print("\nIf you trust the remote server, you can work "
+ "around this error with:\n"
" bugzilla --nosslverify ...")
# Detect redirect
redir = (e.headers and e.headers.getheader("location", 0) or None)
if redir:
- print ("\nServer was attempting a redirect. Try: "
- " bugzilla --bugzilla %s ..." % redir)
+ print("\nServer was attempting a redirect. Try: "
+ " bugzilla --bugzilla %s ..." % redir)
sys.exit(4)
diff --git a/bugzilla/bug.py b/bugzilla/bug.py
index dbff5cb..4a068d3 100644
--- a/bugzilla/bug.py
+++ b/bugzilla/bug.py
@@ -48,7 +48,7 @@ class _Bug(object):
'''Return a simple string representation of this bug
This is available only for compatibility. Using 'str(bug)' and
- 'print bug' is not recommended because of potential encoding issues.
+ 'print(bug)' is not recommended because of potential encoding issues.
Please use unicode(bug) where possible.
'''
return unicode(self).encode(locale.getpreferredencoding(), 'replace')
diff --git a/setup.py b/setup.py
index 27761c4..415eee0 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,7 @@
#!/usr/bin/python
+from __future__ import print_function
+
import glob
import os
import sys
@@ -70,7 +72,7 @@ class TestCommand(Command):
try:
unittest.installHandler()
except:
- print "installHandler hack failed"
+ print("installHandler hack failed")
tests = unittest.TestLoader().loadTestsFromNames(testfiles)
if self.only:
@@ -82,14 +84,14 @@ class TestCommand(Command):
newtests.append(testcase)
if not newtests:
- print "--only didn't find any tests"
+ print("--only didn't find any tests")
sys.exit(1)
tests = unittest.TestSuite(newtests)
- print "Running only:"
+ print("Running only:")
for test in newtests:
- print "%s" % test
- print
+ print("%s" % test)
+ print()
t = unittest.TextTestRunner(verbosity=1)
diff --git a/tests/__init__.py b/tests/__init__.py
index 5122cf0..8d32b39 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,4 +1,6 @@
+from __future__ import print_function
+
import atexit
import commands
import difflib
@@ -71,8 +73,8 @@ def clicomm(argv, bzinstance, returnmain=False, printcliout=False,
ret = 0
mainout = None
try:
- print " ".join(argv)
- print
+ print(" ".join(argv))
+ print()
mainout = bugzillascript.main(bzinstance)
except SystemExit, sys_e:
diff --git a/tests/misc.py b/tests/misc.py
index bb48bcc..865dd8e 100644
--- a/tests/misc.py
+++ b/tests/misc.py
@@ -9,6 +9,8 @@
Unit tests for building query strings with bin/bugzilla
'''
+from __future__ import print_function
+
import atexit
import os
import shutil
@@ -35,7 +37,7 @@ class MiscCLI(unittest.TestCase):
from logilab.common.optik_ext import ManHelpFormatter
ignore = ManHelpFormatter
except Exception, e:
- print "Skipping man page test: %s" % e
+ print("Skipping man page test: %s" % e)
return
out = tests.clicomm("bugzilla --generate-man", None)
@@ -68,7 +70,7 @@ class MiscAPI(unittest.TestCase):
def testCookies(self):
if (sys.version_info[0] < 2 or
(sys.version_info[0] == 2 and sys.version_info[1] < 6)):
- print "\npython too old, skipping cookie test"
+ print("\npython too old, skipping cookie test")
return
cookiesbad = os.path.join(os.getcwd(), "tests/data/cookies-bad.txt")
diff --git a/tests/rw_functional.py b/tests/rw_functional.py
index 8bc9b93..a50f736 100644
--- a/tests/rw_functional.py
+++ b/tests/rw_functional.py
@@ -9,6 +9,8 @@
Unit tests that do permanent functional against a real bugzilla instances.
'''
+from __future__ import print_function
+
import datetime
import os
import random
@@ -63,13 +65,13 @@ class RHPartnerTest(BaseTest):
# Check a known account that likely won't ever go away
ret = bool(bz.getuser("anaconda-maint-list(a)redhat.com").groupnames)
if not ret:
- print "\nNo admin privs, skipping %s" % funcname
+ print("\nNo admin privs, skipping %s" % funcname)
return ret
def _check_rh_privs(self, bz, funcname, quiet=False):
noprivs = bool(bz.getbugs([184858]) == [None])
if noprivs and not quiet:
- print "\nNo RH privs, skipping %s" % funcname
+ print("\nNo RH privs, skipping %s" % funcname)
return not noprivs
@@ -97,7 +99,7 @@ class RHPartnerTest(BaseTest):
bugid = int(newout.splitlines()[2])
bug = bz.getbug(bugid)
- print "\nCreated bugid: %s" % bugid
+ print("\nCreated bugid: %s" % bugid)
# Verify hasattr works
self.assertTrue(hasattr(bug, "id"))
@@ -142,7 +144,7 @@ class RHPartnerTest(BaseTest):
bugid = int(newout.splitlines()[2])
bug = bz.getbug(bugid)
- print "\nCreated bugid: %s" % bugid
+ print("\nCreated bugid: %s" % bugid)
self.assertEquals(bug.summary, summary)
self.assertEquals(bug.bug_file_loc, url)
--
1.8.3.1
10 years, 6 months
Making OR queries with python-bugzilla
by Alexander Todorov
Hi guys,
passing this query disctionary to python bugzilla doesn't seem to work:
{
'j_top' : 'OR',
'field0-0-0' : 'keywords',
'type0-0-0' : 'substring',
'value0-0-0' : 'FutureFeature',
'field0-1-0' : 'short_desc',
'type0-1-0' : 'substring',
'value0-1-0' : 'RFE',
}
As far as I can see it will select BOTH bugs which have the FutureFeature
keyword and Summary contains "RFE". While the webUI can select either of them.
Any ideas how do I make this with python-bugzilla?
Thanks,
Alex
10 years, 6 months
Re: [python-bugzilla] Python 3 support
by Arun Babu Neelicattu
Hi,
I have started work on porting the python-bugzilla for python 3. The work is
being done at [1], this maintains backward compatibility. Currently it is
stable, however I have only performed very limited testing. Hope this is
something the project can use.
The changes on the branch include:
- deprecating pycurl in favor of python-requests
- a fair few pep8 fixes
- generic python 2 to 3 change handling
It'd be great if someone more experienced with the code base can take a look to
see if I've missed anything in particular.
Additionally, if any one has any feedback or performed additional tests, let
me know.
Regards,
Arun
[1] https://github.com/abn/python-bugzilla/tree/py3port
--
Arun Neelicattu / Red Hat Security Response Team
PGP: 0xC244393B 5229 F596 474F 00A1 E416 CF8B 36F5 5054 C244 393B
10 years, 6 months