public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-16 20:00 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-16 20:00 UTC (permalink / raw
  To: gentoo-commits

commit:     1a6b9ae19271717cfe383e6a86451c86ded194d0
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon May 16 11:42:25 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon May 16 11:42:25 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=1a6b9ae1

Initiate the code.

---
 PMSTestSuite/__init__.py |    5 +++++
 setup.py                 |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/PMSTestSuite/__init__.py b/PMSTestSuite/__init__.py
new file mode 100644
index 0000000..3a8bb5c
--- /dev/null
+++ b/PMSTestSuite/__init__.py
@@ -0,0 +1,5 @@
+#	vim:fileencoding=utf-8
+# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 3-clause BSD license or the GPL-2 license.
+
+PV = '0'

diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..ef37614
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2010 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 3-clause BSD license or the GPL-2 license.
+
+from distutils.core import setup
+
+import os.path, sys
+
+sys.path.insert(0, os.path.dirname(__file__))
+try:
+	from PMSTestSuite import PV
+except ImportError:
+	PV = 'unknown'
+
+setup(
+		name = 'pms-test-suite',
+		version = PV,
+		author = 'Michał Górny',
+		author_email = 'mgorny@gentoo.org',
+		url = 'http://www.gentoo.org/proj/en/qa/pms/pms-test-suite.xml',
+
+		packages = ['PMSTestSuite'],
+
+		classifiers = [
+			'Development Status :: 1 - Planning',
+			'Environment :: Console',
+			'Intended Audience :: System Administrators',
+			'License :: OSI Approved :: BSD License',
+			'License :: OSI Approved :: GNU General Public License (GPL)',
+			'Operating System :: POSIX',
+			'Programming Language :: Python',
+			'Topic :: Software Development :: Quality Assurance',
+			'Topic :: Software Development :: Testing',
+			'Topic :: System :: Installation/Setup'
+		]
+)



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-22  9:17 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-22  9:17 UTC (permalink / raw
  To: gentoo-commits

commit:     a29b0bb1c9244bc95de3ef900254712189c108aa
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 22 06:50:25 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 22 06:50:25 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=a29b0bb1

Initially setup the code for BSD license and development state.

---
 COPYING                  |   23 +++++++++++++++++++++++
 MANIFEST.in              |    1 +
 PMSTestSuite/__init__.py |    4 ++--
 setup.py                 |    7 +++----
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..a995d54
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,23 @@
+Copyright (c) <YEAR>, <OWNER>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..eb762f3
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1 @@
+include COPYING

diff --git a/PMSTestSuite/__init__.py b/PMSTestSuite/__init__.py
index 3a8bb5c..18d32ee 100644
--- a/PMSTestSuite/__init__.py
+++ b/PMSTestSuite/__init__.py
@@ -1,5 +1,5 @@
 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 3-clause BSD license or the GPL-2 license.
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
 
 PV = '0'

diff --git a/setup.py b/setup.py
index ef37614..31fde7f 100755
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 #	vim:fileencoding=utf-8
-# (c) 2010 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 3-clause BSD license or the GPL-2 license.
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
 
 from distutils.core import setup
 
@@ -23,11 +23,10 @@ setup(
 		packages = ['PMSTestSuite'],
 
 		classifiers = [
-			'Development Status :: 1 - Planning',
+			'Development Status :: 2 - Pre-Alpha',
 			'Environment :: Console',
 			'Intended Audience :: System Administrators',
 			'License :: OSI Approved :: BSD License',
-			'License :: OSI Approved :: GNU General Public License (GPL)',
 			'Operating System :: POSIX',
 			'Programming Language :: Python',
 			'Topic :: Software Development :: Quality Assurance',



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-29 17:13 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-29 17:13 UTC (permalink / raw
  To: gentoo-commits

commit:     f4b0e82bb93cc782f1aaf54748244c1f994e19e9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 17:13:04 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 17:13:04 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=f4b0e82b

Move common CLI code to PMSTestSuite.cli.

---
 PMSTestSuite/cli.py |   85 +++++++++++++++++++++++++++++++++++++++++++++++++++
 ebuild-generator    |   60 ++++-------------------------------
 2 files changed, 92 insertions(+), 53 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
new file mode 100644
index 0000000..7e73fdd
--- /dev/null
+++ b/PMSTestSuite/cli.py
@@ -0,0 +1,85 @@
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import os.path
+
+from optparse import OptionParser
+
+from PMSTestSuite import PV
+from PMSTestSuite.library import load_library
+from PMSTestSuite.repository import EbuildRepository
+from PMSTestSuite.pm import get_package_managers
+
+class PMSTestSuiteCLI(object):
+	"""
+	A class encapsulating common CLI routines used by PMS Test Suite
+	scripts.
+
+	Properties:
+	1) set during __init__():
+	- optparser (OptionParser);
+	2) set during start():
+	- library (TestLibrary),
+	- pm (PackageManager),
+	- repository (EbuildRepository).
+	"""
+
+	def __init__(self, prog):
+		"""
+		Initialize the class. Set the option parser up.
+		
+		<prog> - program name for optparse output (argv[0])
+		"""
+		opt = OptionParser(
+				prog = os.path.basename(prog),
+				version = PV
+		)
+
+		# XXX: -r for getting through PM's repo_name
+		opt.add_option('-R', '--repository-path', dest='repo_path',
+				help='Path to the repository to store ebuilds in')
+		opt.add_option('-l', '--library', dest='library_name',
+				help='Test library to use (default: standard)',
+				default='standard')
+		# XXX: get list, autodetect, more magic
+		opt.add_option('-p', '--package-manager', dest='pm',
+				help='Package manager to use',
+				default='portage')
+
+		self.optparser = opt
+
+	def start(self, args):
+		"""
+		Initialize the program. Parse command-line args. Instantiate classes
+		encapsulating the Package Manager, test library and repository.
+
+		<args> - command line args (argv[1:])
+		"""
+		opt = self.optparser
+		(opts, args) = opt.parse_args(list(args))
+
+		if not opts.repo_path:
+			opt.error('--repository-path must be specified')
+
+		for x in get_package_managers():
+			if x.name == opts.pm:
+				try:
+					self.pm = x.inst()
+				except Exception as e:
+					opt.error(e)
+				break
+		else:
+			opt.error('Package manager not supported: %s' % opts.pm)
+
+		try:
+			self.repository = EbuildRepository(opts.repo_path)
+		except (OSError, IOError, ValueError) as e:
+			print('Repository open failed: %s' % e)
+			return 1
+
+		try:
+			self.test_library = load_library(opts.library_name)
+		except (ImportError, TypeError) as e:
+			print('Test library load failed: %s' % e)
+			return 1

diff --git a/ebuild-generator b/ebuild-generator
index 1db83ea..dd66b9f 100755
--- a/ebuild-generator
+++ b/ebuild-generator
@@ -3,66 +3,20 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-import os.path, sys
+import sys
 
-from optparse import OptionParser
-
-import PMSTestSuite
-from PMSTestSuite.library import load_library
-from PMSTestSuite.repository import EbuildRepository
-from PMSTestSuite.pm import get_package_managers
+from PMSTestSuite.cli import PMSTestSuiteCLI
 
 def main(prog, *args):
-	opt = OptionParser(
-			prog = os.path.basename(prog),
-			version = PMSTestSuite.PV,
-			description = 'Generate the ebuilds for a test library.'
-	)
-
-	# XXX: -r for getting through PM's repo_name
-	opt.add_option('-R', '--repository-path', dest='repo_path',
-			help='Path to the repository to store ebuilds in')
-	opt.add_option('-l', '--library', dest='library_name',
-			help='Test library to use (default: standard)',
-			default='standard')
-	# XXX: get list, autodetect, more magic
-	opt.add_option('-p', '--package-manager', dest='pm',
-			help='Package manager to use',
-			default='portage')
-
-	(opts, args) = opt.parse_args(list(args))
-
-	if not opts.repo_path:
-		opt.error('--repository-path must be specified')
-
-	for x in get_package_managers():
-		if x.name == opts.pm:
-			try:
-				pm = x.inst()
-			except Exception as e:
-				opt.error(e)
-			break
-	else:
-		opt.error('Package manager not supported: %s' % opts.pm)
-
-	try:
-		repo = EbuildRepository(opts.repo_path)
-	except (OSError, IOError, ValueError) as e:
-		print('Repository open failed: %s' % e)
-		return 1
-
-	try:
-		lib = load_library(opts.library_name)
-	except (ImportError, TypeError) as e:
-		print('Test library load failed: %s' % e)
-		return 1
+	cli = PMSTestSuiteCLI(prog)
+	cli.start(args)
 
 	files = {}
-	for t in lib:
+	for t in cli.test_library:
 		files.update(t.get_output_files())
 
-	repo.write_files(files)
-	repo.remanifest(files, pm)
+	cli.repository.write_files(files)
+	cli.repository.remanifest(files, cli.pm)
 
 if __name__ == '__main__':
 	sys.exit(main(*sys.argv))



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-29 17:46 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-29 17:46 UTC (permalink / raw
  To: gentoo-commits

commit:     9f9e1ac9078d45a71b9b0e4a31af0248cb1caf43
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 17:35:58 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 17:35:58 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=9f9e1ac9

Subclass PMSTestSuiteCLI for actual programs.

---
 PMSTestSuite/cli.py |    2 +-
 ebuild-generator    |   25 ++++++++++++++++---------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index 7e73fdd..a7856d4 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -49,7 +49,7 @@ class PMSTestSuiteCLI(object):
 
 		self.optparser = opt
 
-	def start(self, args):
+	def _start(self, args):
 		"""
 		Initialize the program. Parse command-line args. Instantiate classes
 		encapsulating the Package Manager, test library and repository.

diff --git a/ebuild-generator b/ebuild-generator
index dd66b9f..94b227a 100755
--- a/ebuild-generator
+++ b/ebuild-generator
@@ -7,16 +7,23 @@ import sys
 
 from PMSTestSuite.cli import PMSTestSuiteCLI
 
-def main(prog, *args):
-	cli = PMSTestSuiteCLI(prog)
-	cli.start(args)
+class EbuildGenCLI(PMSTestSuiteCLI):
+	def __init__(self, prog, *args):
+		PMSTestSuiteCLI.__init__(self, prog)
+		self._args = args
 
-	files = {}
-	for t in cli.test_library:
-		files.update(t.get_output_files())
+	def main(self):
+		self._start(self._args)
 
-	cli.repository.write_files(files)
-	cli.repository.remanifest(files, cli.pm)
+		files = {}
+		for t in self.test_library:
+			files.update(t.get_output_files())
+
+		self.repository.write_files(files)
+		self.repository.remanifest(files, self.pm)
+
+		return 0
 
 if __name__ == '__main__':
-	sys.exit(main(*sys.argv))
+	cli = EbuildGenCLI(*sys.argv)
+	sys.exit(cli.main())



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-29 17:46 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-29 17:46 UTC (permalink / raw
  To: gentoo-commits

commit:     8b3a2bcf2b3f49a6b1a29ff76c2242e0e99a8c0f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 17:45:45 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 17:45:45 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=8b3a2bcf

Use argv in main()/_start() instead of __init__().

---
 PMSTestSuite/cli.py |   10 ++++------
 ebuild-generator    |   12 ++++--------
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index a0d957c..746d9f8 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -25,16 +25,13 @@ class PMSTestSuiteCLI(object):
 	- repository (EbuildRepository).
 	"""
 
-	def __init__(self, prog):
+	def __init__(self):
 		"""
 		Initialize the class. Set the option parser up.
 		
 		<prog> - program name for optparse output (argv[0])
 		"""
-		opt = OptionParser(
-				prog = os.path.basename(prog),
-				version = PV
-		)
+		opt = OptionParser(version = PV)
 
 		# XXX: -r for getting through PM's repo_name
 		opt.add_option('-R', '--repository-path', dest='repo_path',
@@ -49,7 +46,7 @@ class PMSTestSuiteCLI(object):
 
 		self.optparser = opt
 
-	def _start(self, args):
+	def _start(self, prog, *args):
 		"""
 		Initialize the program. Parse command-line args. Instantiate classes
 		encapsulating the Package Manager, test library and repository.
@@ -57,6 +54,7 @@ class PMSTestSuiteCLI(object):
 		<args> - command line args (argv[1:])
 		"""
 		opt = self.optparser
+		opt.prog = os.path.basename(prog)
 		(opts, args) = opt.parse_args(list(args))
 
 		if not opts.repo_path:

diff --git a/ebuild-generator b/ebuild-generator
index 94b227a..caac6ba 100755
--- a/ebuild-generator
+++ b/ebuild-generator
@@ -8,12 +8,8 @@ import sys
 from PMSTestSuite.cli import PMSTestSuiteCLI
 
 class EbuildGenCLI(PMSTestSuiteCLI):
-	def __init__(self, prog, *args):
-		PMSTestSuiteCLI.__init__(self, prog)
-		self._args = args
-
-	def main(self):
-		self._start(self._args)
+	def main(self, argv):
+		self._start(*argv)
 
 		files = {}
 		for t in self.test_library:
@@ -25,5 +21,5 @@ class EbuildGenCLI(PMSTestSuiteCLI):
 		return 0
 
 if __name__ == '__main__':
-	cli = EbuildGenCLI(*sys.argv)
-	sys.exit(cli.main())
+	cli = EbuildGenCLI()
+	sys.exit(cli.main(sys.argv))



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-29 17:55 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-29 17:55 UTC (permalink / raw
  To: gentoo-commits

commit:     0c9693ac431f53b6606a1fa13ece08ee5fca4dd9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 17:49:34 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 17:49:34 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=0c9693ac

Move remaining EbuildGenCLI code to PMSTestSuite.ebuildgen.

---
 ebuild-generator => PMSTestSuite/ebuildgen.py |    7 -------
 ebuild-generator                              |   15 +--------------
 2 files changed, 1 insertions(+), 21 deletions(-)

diff --git a/ebuild-generator b/PMSTestSuite/ebuildgen.py
old mode 100755
new mode 100644
similarity index 79%
copy from ebuild-generator
copy to PMSTestSuite/ebuildgen.py
index caac6ba..4a16625
--- a/ebuild-generator
+++ b/PMSTestSuite/ebuildgen.py
@@ -1,10 +1,7 @@
-#!/usr/bin/python
 #	vim:fileencoding=utf-8
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-import sys
-
 from PMSTestSuite.cli import PMSTestSuiteCLI
 
 class EbuildGenCLI(PMSTestSuiteCLI):
@@ -19,7 +16,3 @@ class EbuildGenCLI(PMSTestSuiteCLI):
 		self.repository.remanifest(files, self.pm)
 
 		return 0
-
-if __name__ == '__main__':
-	cli = EbuildGenCLI()
-	sys.exit(cli.main(sys.argv))

diff --git a/ebuild-generator b/ebuild-generator
index caac6ba..f11ac16 100755
--- a/ebuild-generator
+++ b/ebuild-generator
@@ -5,20 +5,7 @@
 
 import sys
 
-from PMSTestSuite.cli import PMSTestSuiteCLI
-
-class EbuildGenCLI(PMSTestSuiteCLI):
-	def main(self, argv):
-		self._start(*argv)
-
-		files = {}
-		for t in self.test_library:
-			files.update(t.get_output_files())
-
-		self.repository.write_files(files)
-		self.repository.remanifest(files, self.pm)
-
-		return 0
+from PMSTestSuite.ebuildgen import EbuildGenCLI
 
 if __name__ == '__main__':
 	cli = EbuildGenCLI()



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-29 17:55 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-29 17:55 UTC (permalink / raw
  To: gentoo-commits

commit:     467df55c6a11a3f9be5437ab3851e2dbd770bbda
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 17:53:53 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 17:53:53 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=467df55c

Add an instantiation test for PMSTestSuite.cli.

---
 PMSTestSuite/cli.py |    2 ++
 run-tests.py        |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index 746d9f8..b5c8921 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -23,6 +23,8 @@ class PMSTestSuiteCLI(object):
 	- library (TestLibrary),
 	- pm (PackageManager),
 	- repository (EbuildRepository).
+
+	>>> cli = PMSTestSuiteCLI()
 	"""
 
 	def __init__(self):

diff --git a/run-tests.py b/run-tests.py
index fe3a8d8..6709a6b 100755
--- a/run-tests.py
+++ b/run-tests.py
@@ -2,11 +2,13 @@
 
 import unittest, doctest
 
+import PMSTestSuite.cli
 import PMSTestSuite.library
 import PMSTestSuite.pm
 import PMSTestSuite.repository
 
 def load_tests(loader, tests, ignore):
+	tests.addTests(doctest.DocTestSuite(PMSTestSuite.cli))
 	tests.addTests(doctest.DocTestSuite(PMSTestSuite.library))
 	tests.addTests(doctest.DocTestSuite(PMSTestSuite.library.case))
 	tests.addTests(doctest.DocTestSuite(PMSTestSuite.pm))



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-05-29 18:57 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-05-29 18:57 UTC (permalink / raw
  To: gentoo-commits

commit:     1c1aee40f87920237512e4a10e82459aad52bb82
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun May 29 18:26:14 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun May 29 18:26:14 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=1c1aee40

Add an initial code for TestRunner (no-op).

---
 PMSTestSuite/testrunner.py |   10 ++++++++++
 pms-tester                 |   12 ++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
new file mode 100644
index 0000000..b3948ee
--- /dev/null
+++ b/PMSTestSuite/testrunner.py
@@ -0,0 +1,10 @@
+from PMSTestSuite.ebuildgen import EbuildGenCLI
+
+class TestRunnerCLI(EbuildGenCLI):
+	def main(self, argv):
+		print('-> Generating ebuilds...')
+		ret = EbuildGenCLI.main(self, argv)
+		if ret != 0:
+			return ret
+
+		return 0

diff --git a/pms-tester b/pms-tester
new file mode 100755
index 0000000..ededbef
--- /dev/null
+++ b/pms-tester
@@ -0,0 +1,12 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+import sys
+
+from PMSTestSuite.testrunner import TestRunnerCLI
+
+if __name__ == '__main__':
+	cli = TestRunnerCLI()
+	sys.exit(cli.main(sys.argv))



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-06-01 12:30 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-06-01 12:30 UTC (permalink / raw
  To: gentoo-commits

commit:     a2ea5ae1a6818a5ac12b0cf2f07ccc2aa365f0de
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  1 11:19:04 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 11:19:04 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=a2ea5ae1

Drop separate ebuild-generator.

---
 PMSTestSuite/ebuildgen.py  |   18 ------------------
 PMSTestSuite/testrunner.py |   11 ++++++++---
 ebuild-generator           |   12 ------------
 3 files changed, 8 insertions(+), 33 deletions(-)

diff --git a/PMSTestSuite/ebuildgen.py b/PMSTestSuite/ebuildgen.py
deleted file mode 100644
index 4a16625..0000000
--- a/PMSTestSuite/ebuildgen.py
+++ /dev/null
@@ -1,18 +0,0 @@
-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-from PMSTestSuite.cli import PMSTestSuiteCLI
-
-class EbuildGenCLI(PMSTestSuiteCLI):
-	def main(self, argv):
-		self._start(*argv)
-
-		files = {}
-		for t in self.test_library:
-			files.update(t.get_output_files())
-
-		self.repository.write_files(files)
-		self.repository.remanifest(files, self.pm)
-
-		return 0

diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
index e435093..19c3749 100644
--- a/PMSTestSuite/testrunner.py
+++ b/PMSTestSuite/testrunner.py
@@ -28,10 +28,15 @@ class TestRunnerCLI(EbuildGenCLI):
 		self.loop.quit()
 
 	def main(self, argv):
+		self._start(*argv)
+
 		print('-> Generating ebuilds...')
-		ret = EbuildGenCLI.main(self, argv)
-		if ret != 0:
-			return ret
+		files = {}
+		for t in self.test_library:
+			files.update(t.get_output_files())
+
+		self.repository.write_files(files)
+		self.repository.remanifest(files, self.pm)
 
 		self.pm.append_repository(self.repository)
 		self.cpvs = [t.cpv for t in self.test_library]

diff --git a/ebuild-generator b/ebuild-generator
deleted file mode 100755
index f11ac16..0000000
--- a/ebuild-generator
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/python
-#	vim:fileencoding=utf-8
-# (c) 2011 Michał Górny <mgorny@gentoo.org>
-# Released under the terms of the 2-clause BSD license.
-
-import sys
-
-from PMSTestSuite.ebuildgen import EbuildGenCLI
-
-if __name__ == '__main__':
-	cli = EbuildGenCLI()
-	sys.exit(cli.main(sys.argv))



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/
@ 2011-06-01 12:30 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-06-01 12:30 UTC (permalink / raw
  To: gentoo-commits

commit:     29fa19fb5db1c860bc7c54df6426aea5aaac063d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  1 11:23:32 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  1 11:23:32 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=29fa19fb

Commonize the CLI code for single executable.

---
 PMSTestSuite/cli.py        |   55 ++++++++++++++++++++++++++++++++++++++++++-
 PMSTestSuite/testrunner.py |   55 --------------------------------------------
 pms-tester                 |    4 +-
 3 files changed, 55 insertions(+), 59 deletions(-)

diff --git a/PMSTestSuite/cli.py b/PMSTestSuite/cli.py
index 7db4713..f7eb7ae 100644
--- a/PMSTestSuite/cli.py
+++ b/PMSTestSuite/cli.py
@@ -3,6 +3,7 @@
 # Released under the terms of the 2-clause BSD license.
 
 import os.path, shlex
+import gobject
 
 from optparse import OptionParser
 
@@ -13,8 +14,7 @@ from PMSTestSuite.pm import get_package_managers
 
 class PMSTestSuiteCLI(object):
 	"""
-	A class encapsulating common CLI routines used by PMS Test Suite
-	scripts.
+	A class encapsulating CLI routines used by the PMS Test Suite.
 
 	Properties:
 	1) set during __init__():
@@ -84,3 +84,54 @@ class PMSTestSuiteCLI(object):
 			self.test_library = load_library(opts.library_name)
 		except (ImportError, TypeError) as e:
 			opt.error('Test library load failed: %s' % e)
+
+	def merge_done(self, pid, ret):
+		failed = []
+
+		cpvs = frozenset(self.pm.lookup_vardb(self.cpvs))
+		for t in self.test_library:
+			res = t.check_result(t.cpv in cpvs)
+			if not res:
+				failed.append(t)
+
+		if len(failed) != len(self.cpvs):
+			print('-> Unmerging test ebuilds...')
+			self.pm.unmerge(cpvs)
+
+		if not failed:
+			print('%d tests completed successfully.' % len(self.cpvs))
+		else:
+			print('%d of %d tests completed successfully, %d failed:'
+					% (len(self.cpvs) - len(failed), len(self.cpvs), len(failed)))
+			for t in failed:
+				print('- %s' % t.p)
+
+		self.ret = 0 if not failed else 1
+		self.loop.quit()
+
+	def main(self, argv):
+		self._start(*argv)
+
+		print('-> Generating ebuilds...')
+		files = {}
+		for t in self.test_library:
+			files.update(t.get_output_files())
+
+		self.repository.write_files(files)
+		self.repository.remanifest(files, self.pm)
+
+		self.pm.append_repository(self.repository)
+		self.cpvs = [t.cpv for t in self.test_library]
+
+		installedcpvs = self.pm.lookup_vardb(self.cpvs)
+		if installedcpvs:
+			print('-> Unmerging already-merged test ebuilds...')
+			self.pm.unmerge(installedcpvs)
+
+		print('-> Running PM...')
+		self.loop = gobject.MainLoop()
+		gobject.child_watch_add(self.pm.merge_async(self.cpvs),
+				self.merge_done)
+		self.loop.run()
+
+		return self.ret

diff --git a/PMSTestSuite/testrunner.py b/PMSTestSuite/testrunner.py
deleted file mode 100644
index 19c3749..0000000
--- a/PMSTestSuite/testrunner.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from PMSTestSuite.ebuildgen import EbuildGenCLI
-
-import gobject
-
-class TestRunnerCLI(EbuildGenCLI):
-	def merge_done(self, pid, ret):
-		failed = []
-
-		cpvs = frozenset(self.pm.lookup_vardb(self.cpvs))
-		for t in self.test_library:
-			res = t.check_result(t.cpv in cpvs)
-			if not res:
-				failed.append(t)
-
-		if len(failed) != len(self.cpvs):
-			print('-> Unmerging test ebuilds...')
-			self.pm.unmerge(cpvs)
-
-		if not failed:
-			print('%d tests completed successfully.' % len(self.cpvs))
-		else:
-			print('%d of %d tests completed successfully, %d failed:'
-					% (len(self.cpvs) - len(failed), len(self.cpvs), len(failed)))
-			for t in failed:
-				print('- %s' % t.p)
-
-		self.ret = 0 if not failed else 1
-		self.loop.quit()
-
-	def main(self, argv):
-		self._start(*argv)
-
-		print('-> Generating ebuilds...')
-		files = {}
-		for t in self.test_library:
-			files.update(t.get_output_files())
-
-		self.repository.write_files(files)
-		self.repository.remanifest(files, self.pm)
-
-		self.pm.append_repository(self.repository)
-		self.cpvs = [t.cpv for t in self.test_library]
-
-		installedcpvs = self.pm.lookup_vardb(self.cpvs)
-		if installedcpvs:
-			print('-> Unmerging already-merged test ebuilds...')
-			self.pm.unmerge(installedcpvs)
-
-		print('-> Running PM...')
-		self.loop = gobject.MainLoop()
-		gobject.child_watch_add(self.pm.merge_async(self.cpvs),
-				self.merge_done)
-		self.loop.run()
-
-		return self.ret

diff --git a/pms-tester b/pms-tester
index ededbef..317b587 100755
--- a/pms-tester
+++ b/pms-tester
@@ -5,8 +5,8 @@
 
 import sys
 
-from PMSTestSuite.testrunner import TestRunnerCLI
+from PMSTestSuite.cli import PMSTestSuiteCLI
 
 if __name__ == '__main__':
-	cli = TestRunnerCLI()
+	cli = PMSTestSuiteCLI()
 	sys.exit(cli.main(sys.argv))



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/
@ 2011-06-27 21:24 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2011-06-27 21:24 UTC (permalink / raw
  To: gentoo-commits

commit:     86aeadea7afe133f77761b65c111f1dc27866483
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 27 21:23:05 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jun 27 21:23:05 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=86aeadea

Bump PV to 0.0.1.

---
 pmstestsuite/__init__.py |    2 +-
 setup.py                 |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/pmstestsuite/__init__.py b/pmstestsuite/__init__.py
index 18d32ee..0a2802c 100644
--- a/pmstestsuite/__init__.py
+++ b/pmstestsuite/__init__.py
@@ -2,4 +2,4 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-PV = '0'
+PV = '0.0.1'

diff --git a/setup.py b/setup.py
index 365968d..6931681 100755
--- a/setup.py
+++ b/setup.py
@@ -136,7 +136,7 @@ setup(
 		],
 
 		classifiers = [
-			'Development Status :: 2 - Pre-Alpha',
+			'Development Status :: 3 - Alpha',
 			'Environment :: Console',
 			'Intended Audience :: System Administrators',
 			'License :: OSI Approved :: BSD License',



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/
@ 2012-01-03 15:52 Michał Górny
  0 siblings, 0 replies; 12+ messages in thread
From: Michał Górny @ 2012-01-03 15:52 UTC (permalink / raw
  To: gentoo-commits

commit:     7e5c58594f88551c0727647faa7ea85fed6bf205
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  3 11:31:54 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jan  3 11:31:54 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=7e5c5859

Generate D-Bus configuration file in runtime.

---
 bus.conf                     |   18 ------------------
 pmstestsuite/dbus_handler.py |   28 ++++++++++++++++++++++++++--
 2 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/bus.conf b/bus.conf
deleted file mode 100644
index a078c1c..0000000
--- a/bus.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
-	"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-
-<busconfig>
-	<type>session</type>
-	<listen>unix:tmpdir=/tmp</listen>
-
-	<user>portage</user> <!-- XXX -->
-
-	<policy context="default">
-		<allow user="root"/>
-
-		<allow send_destination="*" eavesdrop="true"/>
-		<allow eavesdrop="true"/>
-		<allow own="*"/>
-	</policy>
-</busconfig>

diff --git a/pmstestsuite/dbus_handler.py b/pmstestsuite/dbus_handler.py
index 9a8c529..456e63d 100644
--- a/pmstestsuite/dbus_handler.py
+++ b/pmstestsuite/dbus_handler.py
@@ -2,27 +2,51 @@
 # (c) 2011-2012 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-import dbus, os, signal
+import dbus, os, signal, tempfile
 from dbus.mainloop.glib import DBusGMainLoop
 
 dbus_interface_name = 'org.gentoo.pmstestsuite'
 dbus_bus_name = dbus_interface_name
 dbus_object_prefix = '/org/gentoo/pmstestsuite'
 
+dbus_config = """<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+	"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+
+<busconfig>
+	<type>session</type>
+	<listen>unix:tmpdir=/tmp</listen>
+
+	<user>%s</user>
+
+	<policy context="default">
+		<allow user="root"/>
+
+		<allow send_destination="*" eavesdrop="true"/>
+		<allow eavesdrop="true"/>
+		<allow own="*"/>
+	</policy>
+</busconfig>"""
+
 class DBusHandler(object):
 	""" A class handling all D-Bus interaction for PMS Test Suite. """
 
 	def start_dbus(self, uid):
+		tmpf = tempfile.NamedTemporaryFile('w')
+		tmpf.write(dbus_config % uid)
+		tmpf.flush()
+
 		(read_fd, write_fd) = os.pipe()
 		self.dbus_pid = os.fork()
 		if self.dbus_pid == 0:
 			os.close(read_fd)
 			os.execlp('dbus-daemon', 'dbus-daemon', '--nofork',
-				'--config-file=bus.conf', # XXX: path
+				'--config-file=%s' % tmpf.name,
 				'--print-address=%d' % write_fd)
 		else:
 			addr = os.read(read_fd, 1024)
 			os.close(write_fd)
+			tmpf.close()
 
 			self.bus_address = addr.strip()
 



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-01-03 15:53 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-01 12:30 [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2012-01-03 15:52 [gentoo-commits] proj/pms-test-suite:master commit in: /, pmstestsuite/ Michał Górny
2011-06-27 21:24 Michał Górny
2011-06-01 12:30 [gentoo-commits] proj/pms-test-suite:master commit in: /, PMSTestSuite/ Michał Górny
2011-05-29 18:57 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-29 17:46 Michał Górny
2011-05-29 17:46 Michał Górny
2011-05-29 17:13 Michał Górny
2011-05-22  9:17 Michał Górny
2011-05-16 20:00 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox