aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Sennhauser <sera@gentoo.org>2013-02-08 18:25:13 +0000
committerRalph Sennhauser <sera@gentoo.org>2013-02-08 18:25:13 +0000
commit70116750e133bd58f89b3559a4f894032dd152b6 (patch)
tree6b1c791c60f006cd9df1288f55479f3fbfe0075a
parentAdd ROOT and EPREFIX support to EnvironmentManager (diff)
downloadjava-config-70116750e133bd58f89b3559a4f894032dd152b6.tar.gz
java-config-70116750e133bd58f89b3559a4f894032dd152b6.tar.bz2
java-config-70116750e133bd58f89b3559a4f894032dd152b6.zip
Use new ROOT support in EnvironmentManager for testsuite
Merge vm_configs virtual_configs and package env files into a single tree test_env with the standard environment layout useable by EnvironmentManager. Adopt testsuite to run using the fake environment, this finally allows to run the testsuite from within ebuilds. svn path=/projects/java-config-2/trunk/; revision=9186
-rw-r--r--tests/testsuite/EnvironmentManager.py20
-rw-r--r--tests/testsuite/Package.py13
-rw-r--r--tests/testsuite/VM.py12
-rw-r--r--tests/testsuite/VersionManager.py26
-rw-r--r--tests/testsuite/Virtual.py24
-rw-r--r--tests/testsuite/__init__.py5
-rw-r--r--tests/testsuite/test_env/etc/java-config-2/virtuals0
-rw-r--r--tests/testsuite/test_env/usr/share/ant-cores/package.env (renamed from tests/testsuite/packages/ant-cores/package.env)0
-rw-r--r--tests/testsuite/test_env/usr/share/ant-cores5/package.env (renamed from tests/testsuite/packages/ant-cores5/package.env)0
-rw-r--r--tests/testsuite/test_env/usr/share/commons-logging/package.env (renamed from tests/testsuite/packages/commons-logging/package.env)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/virtuals/jaf (renamed from tests/testsuite/virtual_configs/jaf)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/virtuals/jdbc (renamed from tests/testsuite/virtual_configs/jdbc)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/virtuals/jmx (renamed from tests/testsuite/virtual_configs/jmx)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/virtuals/jmx2 (renamed from tests/testsuite/virtual_configs/jmx2)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/vm/blackdown-jdk-1.4.2 (renamed from tests/testsuite/vm_configs/blackdown-jdk-1.4.2)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/vm/ibm-jdk-bin-1.5 (renamed from tests/testsuite/vm_configs/ibm-jdk-bin-1.5)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jdk-1.6 (renamed from tests/testsuite/vm_configs/sun-jdk-1.6)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jdk-1.7 (renamed from tests/testsuite/vm_configs/sun-jdk-1.7)0
-rw-r--r--tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jre-bin-1.6 (renamed from tests/testsuite/vm_configs/sun-jre-bin-1.6)0
-rw-r--r--tests/testsuite/test_env/usr/share/jdbc-mysql/package.env (renamed from tests/testsuite/packages/jdbc-mysql/package.env)0
-rw-r--r--tests/testsuite/test_env/usr/share/jdbc-postgresql/package.env (renamed from tests/testsuite/packages/jdbc-postgresql/package.env)0
-rw-r--r--tests/testsuite/test_env/usr/share/log4j/package.env (renamed from tests/testsuite/packages/log4j/package.env)0
-rw-r--r--tests/testsuite/test_env/usr/share/test-package/package.env (renamed from tests/testsuite/packages/test-package/package.env)0
23 files changed, 49 insertions, 51 deletions
diff --git a/tests/testsuite/EnvironmentManager.py b/tests/testsuite/EnvironmentManager.py
index fe810e8..2dd863b 100644
--- a/tests/testsuite/EnvironmentManager.py
+++ b/tests/testsuite/EnvironmentManager.py
@@ -1,21 +1,23 @@
-import unittest
-import os
+import os, unittest
-from java_config_2.EnvironmentManager import EnvironmentManager as em
+from java_config_2.EnvironmentManager import EnvironmentManager
class TestEnvironmentManager(unittest.TestCase):
- path=""
+
+ def setUp(self):
+ self.em = EnvironmentManager(os.path.join(os.path.dirname(__file__), 'test_env'))
+ self.em.set_active_vm(self.em.find_vm('ibm-jdk-bin-1.5'))
def test_load_packages(self):
- em.packages = {}
- em.load_packages()
- self.assertEqual(len(em.packages), 11)
+ self.em.packages = {}
+ self.em.load_packages()
+ self.assertEquals(len(self.em.get_packages()), 11)
def test_get_package(self):
- em.get_package('ant-cores')
+ self.em.get_package('ant-cores')
def test_build_dep_path(self):
- self.assertTrue( len(em.build_dep_path(["jdbc"], "CLASSPATH", set())) > 2)
+ self.assertTrue( len(self.em.build_dep_path(["jdbc"], "CLASSPATH", set())) > 2)
if __name__ == '__main__':
unittest.main()
diff --git a/tests/testsuite/Package.py b/tests/testsuite/Package.py
index 52c2405..be9d23f 100644
--- a/tests/testsuite/Package.py
+++ b/tests/testsuite/Package.py
@@ -1,17 +1,14 @@
-import unittest
-import os
+import os, unittest
+from java_config_2.EnvironmentManager import EnvironmentManager
from java_config_2.Package import Package
class TestPackage(unittest.TestCase):
- path = os.path.join(os.path.dirname(__file__), 'packages', '%s/package.env')
-
- def load_package(self, package):
- config = TestPackage.path % package
- return Package(package, config)
def setUp(self):
- self.ant = self.load_package('ant-cores')
+ em = EnvironmentManager(os.path.join(os.path.dirname(__file__), 'test_env'))
+
+ self.ant = em.get_package('ant-cores')
def test_package_info(self):
#using a package we definitely
diff --git a/tests/testsuite/VM.py b/tests/testsuite/VM.py
index a8ecff0..5f1c477 100644
--- a/tests/testsuite/VM.py
+++ b/tests/testsuite/VM.py
@@ -1,17 +1,19 @@
-import unittest
+import os, unittest
+
+from java_config_2.EnvironmentManager import EnvironmentManager
from java_config_2.VM import VM
-import os
class TestVM(unittest.TestCase):
- path = os.path.join(os.path.dirname(__file__), 'vm_configs')
def load_vm(self, vm):
config = os.path.join(self.path,vm)
return VM(config)
def setUp(self):
- self.ibm = self.load_vm('ibm-jdk-bin-1.5')
- self.black = self.load_vm('blackdown-jdk-1.4.2')
+ em = EnvironmentManager(os.path.join(os.path.dirname(__file__), 'test_env'))
+
+ self.ibm = em.get_vm('ibm-jdk-bin-1.5')
+ self.black = em.get_vm('blackdown-jdk-1.4.2')
def test_empty_provide(self):
self.assertFalse(self.ibm.provides("foobar"))
diff --git a/tests/testsuite/VersionManager.py b/tests/testsuite/VersionManager.py
index 4c9d1a5..3700be8 100644
--- a/tests/testsuite/VersionManager.py
+++ b/tests/testsuite/VersionManager.py
@@ -1,13 +1,15 @@
-import unittest
-import os
+import os, unittest
+
from java_config_2.VersionManager import VersionManager
from java_config_2.EnvironmentManager import EnvironmentManager
class TestVersionManager(unittest.TestCase):
- envman = EnvironmentManager()
- verman = VersionManager(envman)
def setUp(self):
+ self.em = EnvironmentManager(os.path.join(os.path.dirname(__file__), 'test_env'))
+ self.em.set_active_vm(self.em.find_vm('ibm-jdk-bin-1.5'))
+ self.verman = VersionManager(self.em)
+
self.example_dep_vanilla = ">=virtual/jdk-1.5* dev-java/ant-core java-virtuals/jaf"
self.example_dep_or = "|| ( =virtual/jdk-1.5 =virtual/jdk-1.4 ) dev-java/ant-core java-virtuals/jaf"
self.example_dep_use = "java? ( >=virtual/jdk-1.5* ) dev-java/ant-core java-virtuals/jaf"
@@ -36,21 +38,21 @@ class TestVersionManager(unittest.TestCase):
def test_filter_depend_vanilla(self):
os.environ["USE"] = ""
- self.assertEqual(self.verman.filter_depend(self.example_dep_vanilla), self.example_dep_vanilla)
+ self.assertEquals(self.verman.filter_depend(self.example_dep_vanilla), self.example_dep_vanilla)
def test_filter_depend_or(self):
# Oh you only realise how ugly things are once you write unittests.
os.environ["USE"] = ""
rmatch = "|| =virtual/jdk-1.5 =virtual/jdk-1.4 dev-java/ant-core java-virtuals/jaf"
- self.assertEqual(self.verman.filter_depend(self.example_dep_or), rmatch)
+ self.assertEquals(self.verman.filter_depend(self.example_dep_or), rmatch)
def test_filter_depend_use(self):
os.environ["USE"] = "java"
rmatch = ">=virtual/jdk-1.5* dev-java/ant-core java-virtuals/jaf"
- self.assertEqual(self.verman.filter_depend(self.example_dep_use), rmatch)
+ self.assertEquals(self.verman.filter_depend(self.example_dep_use), rmatch)
def test_version_satisfies(self):
- vm = self.envman.get_vm('sun-jdk-1.6')
+ vm = self.em.get_vm('sun-jdk-1.6')
self.assertTrue(self.verman.version_satisfies('>=virtual/jdk-1.5', vm))
self.assertFalse(self.verman.version_satisfies('>=virtual/jdk-1.7', vm))
self.assertTrue(self.verman.version_satisfies('|| ( =virtual/jdk-1.6 =virtual/jdk-1.5 )', vm))
@@ -76,13 +78,13 @@ class TestVersionManager(unittest.TestCase):
def test_get_lowest(self):
target = self.verman.get_lowest(">=virtual/jdk-1.4")
- self.assertEqual(target, '1.4')
+ self.assertEquals(target, '1.4')
target = self.verman.get_lowest(self.example_dep_vanilla)
- self.assertEqual(target, '1.5')
+ self.assertEquals(target, '1.5')
target = self.verman.get_lowest(self.example_dep_or)
- self.assertEqual(target, '1.4')
+ self.assertEquals(target, '1.4')
def test_get_lowest_with_package_dep(self):
pass
@@ -96,7 +98,7 @@ class TestVersionManager(unittest.TestCase):
#def test_matches(self):
def test_version_cmp(self):
- self.assertEqual(self.verman.version_cmp('1.5.2', '1.5.2'), 0)
+ self.assertEquals(self.verman.version_cmp('1.5.2', '1.5.2'), 0)
self.assertTrue(self.verman.version_cmp('1.5', '1.5.1') < 0)
self.assertTrue(self.verman.version_cmp('1.5.1', '1.5') > 0)
diff --git a/tests/testsuite/Virtual.py b/tests/testsuite/Virtual.py
index d511d64..3db1561 100644
--- a/tests/testsuite/Virtual.py
+++ b/tests/testsuite/Virtual.py
@@ -1,20 +1,18 @@
-import unittest
-import os
+import os, unittest
+
from java_config_2.Virtual import Virtual
-from java_config_2.EnvironmentManager import EnvironmentManager as em
+from java_config_2.EnvironmentManager import EnvironmentManager
from java_config_2.Errors import ProviderUnavailableError
-def load_virtual(virtual):
- config = os.path.join(TestVirtual.path, virtual)
- return Virtual(virtual, em, config)
-
class TestVirtual(unittest.TestCase):
- path = os.path.join(os.path.dirname(__file__), "virtual_configs") + "/"
def setUp(self):
- self.jaf = load_virtual('jaf')
- self.jmx = load_virtual('jmx')
- self.jmx2 = load_virtual('jmx2')
+ em = EnvironmentManager(os.path.join(os.path.dirname(__file__), 'test_env'))
+ em.set_active_vm(em.find_vm('ibm-jdk-bin-1.5'))
+
+ self.jaf = em.get_virtual('jaf')
+ self.jmx = em.get_virtual('jmx')
+ self.jmx2 = em.get_virtual('jmx2')
def test_get_vms(self):
self.assertEqual(self.jaf.get_vms(), ['sun-jdk-1.6'])
@@ -28,8 +26,10 @@ class TestVirtual(unittest.TestCase):
class TestMultiProviderVirtual(unittest.TestCase):
def setUp(self):
+ em = EnvironmentManager(os.path.join(os.path.dirname(__file__), 'test_env'))
em.set_active_vm(em.get_vm('sun-jdk-1.6'))
- self.jdbc = load_virtual('jdbc')
+
+ self.jdbc = em.get_virtual('jdbc')
def test_classpath_multiple(self):
self.assertEqual( len(self.jdbc.classpath().split(':')), 2)
diff --git a/tests/testsuite/__init__.py b/tests/testsuite/__init__.py
index d738781..06c70e0 100644
--- a/tests/testsuite/__init__.py
+++ b/tests/testsuite/__init__.py
@@ -4,10 +4,5 @@ from . import Virtual
from . import Package
from . import VersionManager
from . import EnvironmentManager
-from java_config_2.EnvironmentManager import EnvironmentManager as em
-em.vms_path = VM.TestVM.path
-em.pkg_path = Package.TestPackage.path
-em.virtual_path = Virtual.TestVirtual.path
-em.set_active_vm(em.find_vm('ibm-jdk-bin-1.5'))
# vim:set expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap:
diff --git a/tests/testsuite/test_env/etc/java-config-2/virtuals b/tests/testsuite/test_env/etc/java-config-2/virtuals
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/testsuite/test_env/etc/java-config-2/virtuals
diff --git a/tests/testsuite/packages/ant-cores/package.env b/tests/testsuite/test_env/usr/share/ant-cores/package.env
index ebda9b7..ebda9b7 100644
--- a/tests/testsuite/packages/ant-cores/package.env
+++ b/tests/testsuite/test_env/usr/share/ant-cores/package.env
diff --git a/tests/testsuite/packages/ant-cores5/package.env b/tests/testsuite/test_env/usr/share/ant-cores5/package.env
index 9b378a9..9b378a9 100644
--- a/tests/testsuite/packages/ant-cores5/package.env
+++ b/tests/testsuite/test_env/usr/share/ant-cores5/package.env
diff --git a/tests/testsuite/packages/commons-logging/package.env b/tests/testsuite/test_env/usr/share/commons-logging/package.env
index 0226096..0226096 100644
--- a/tests/testsuite/packages/commons-logging/package.env
+++ b/tests/testsuite/test_env/usr/share/commons-logging/package.env
diff --git a/tests/testsuite/virtual_configs/jaf b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jaf
index 1c5fc73..1c5fc73 100644
--- a/tests/testsuite/virtual_configs/jaf
+++ b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jaf
diff --git a/tests/testsuite/virtual_configs/jdbc b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jdbc
index b34347d..b34347d 100644
--- a/tests/testsuite/virtual_configs/jdbc
+++ b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jdbc
diff --git a/tests/testsuite/virtual_configs/jmx b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jmx
index 81fdbd7..81fdbd7 100644
--- a/tests/testsuite/virtual_configs/jmx
+++ b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jmx
diff --git a/tests/testsuite/virtual_configs/jmx2 b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jmx2
index 6d24b79..6d24b79 100644
--- a/tests/testsuite/virtual_configs/jmx2
+++ b/tests/testsuite/test_env/usr/share/java-config-2/virtuals/jmx2
diff --git a/tests/testsuite/vm_configs/blackdown-jdk-1.4.2 b/tests/testsuite/test_env/usr/share/java-config-2/vm/blackdown-jdk-1.4.2
index 3504f8e..3504f8e 100644
--- a/tests/testsuite/vm_configs/blackdown-jdk-1.4.2
+++ b/tests/testsuite/test_env/usr/share/java-config-2/vm/blackdown-jdk-1.4.2
diff --git a/tests/testsuite/vm_configs/ibm-jdk-bin-1.5 b/tests/testsuite/test_env/usr/share/java-config-2/vm/ibm-jdk-bin-1.5
index 20e30fc..20e30fc 100644
--- a/tests/testsuite/vm_configs/ibm-jdk-bin-1.5
+++ b/tests/testsuite/test_env/usr/share/java-config-2/vm/ibm-jdk-bin-1.5
diff --git a/tests/testsuite/vm_configs/sun-jdk-1.6 b/tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jdk-1.6
index 501935e..501935e 100644
--- a/tests/testsuite/vm_configs/sun-jdk-1.6
+++ b/tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jdk-1.6
diff --git a/tests/testsuite/vm_configs/sun-jdk-1.7 b/tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jdk-1.7
index 71a5d5b..71a5d5b 100644
--- a/tests/testsuite/vm_configs/sun-jdk-1.7
+++ b/tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jdk-1.7
diff --git a/tests/testsuite/vm_configs/sun-jre-bin-1.6 b/tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jre-bin-1.6
index b9f6fdd..b9f6fdd 100644
--- a/tests/testsuite/vm_configs/sun-jre-bin-1.6
+++ b/tests/testsuite/test_env/usr/share/java-config-2/vm/sun-jre-bin-1.6
diff --git a/tests/testsuite/packages/jdbc-mysql/package.env b/tests/testsuite/test_env/usr/share/jdbc-mysql/package.env
index 1ec5d2f..1ec5d2f 100644
--- a/tests/testsuite/packages/jdbc-mysql/package.env
+++ b/tests/testsuite/test_env/usr/share/jdbc-mysql/package.env
diff --git a/tests/testsuite/packages/jdbc-postgresql/package.env b/tests/testsuite/test_env/usr/share/jdbc-postgresql/package.env
index 2beb488..2beb488 100644
--- a/tests/testsuite/packages/jdbc-postgresql/package.env
+++ b/tests/testsuite/test_env/usr/share/jdbc-postgresql/package.env
diff --git a/tests/testsuite/packages/log4j/package.env b/tests/testsuite/test_env/usr/share/log4j/package.env
index ed19d32..ed19d32 100644
--- a/tests/testsuite/packages/log4j/package.env
+++ b/tests/testsuite/test_env/usr/share/log4j/package.env
diff --git a/tests/testsuite/packages/test-package/package.env b/tests/testsuite/test_env/usr/share/test-package/package.env
index 193c715..193c715 100644
--- a/tests/testsuite/packages/test-package/package.env
+++ b/tests/testsuite/test_env/usr/share/test-package/package.env