aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-07-10 21:00:15 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-07-10 21:00:15 +0000
commit542252c73f0727514126edc79080b796b34128cc (patch)
treedbe8e4b1b6393b629716393f7ed9e927665450cf
parent001ef329477cfd6a50babf9b00d73f132d0aa262 (diff)
downloadpaludis-542252c73f0727514126edc79080b796b34128cc.tar.gz
paludis-542252c73f0727514126edc79080b796b34128cc.tar.xz
(python) Add TestEnvironment. Fix OUTPUT_WRAPPER.
-rw-r--r--python/Makefile.am3
-rwxr-xr-xpython/dep_tag_TEST.py6
-rw-r--r--python/environment.cc13
-rwxr-xr-xpython/environment_TEST.py3
4 files changed, 24 insertions, 1 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index 5703907..415bcfb 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -79,6 +79,8 @@ EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \
repository_TEST_setup.sh repository_TEST_cleanup.sh
TESTS_ENVIRONMENT = env \
+ TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \
+ PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \
PALUDIS_NO_GLOBAL_HOOKS="yes" \
PALUDIS_NO_XTERM_TITLES="yes" \
PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/e/ebuild/`" \
@@ -130,6 +132,7 @@ libpaludispython_la_LIBADD = \
$(top_builddir)/paludis/environments/paludis/libpaludispaludisenvironment.la \
$(top_builddir)/paludis/environments/no_config/libpaludisnoconfigenvironment.la \
$(top_builddir)/paludis/environments/adapted/libpaludisadaptedenvironment.la \
+ $(top_builddir)/paludis/environments/test/libpaludistestenvironment.la \
$(top_builddir)/paludis/environments/libpaludisenvironments.la
# $(top_builddir)/paludis/qa/libpaludisqa.la
diff --git a/python/dep_tag_TEST.py b/python/dep_tag_TEST.py
index 19c7186..b9677cf 100755
--- a/python/dep_tag_TEST.py
+++ b/python/dep_tag_TEST.py
@@ -18,6 +18,10 @@
# Place, Suite 330, Boston, MA 02111-1307 USA
#
+import os
+
+os.environ["PALUDIS_HOME"] = os.path.join(os.getcwd(), "depp_tag_TEST_dir/home")
+
from paludis import *
import unittest
@@ -54,7 +58,7 @@ class TestCase_03_GeneralSetDepTag(unittest.TestCase):
class TestCase_04_DependencyDepTag(unittest.TestCase):
def setUp(self):
global dt, pid, pds, cds
- env = EnvironmentMaker.instance.make_from_spec("")
+ env = TestEnvironment()
repo = FakeRepository(env, "repo")
pid = repo.add_version("cat/foo", "1.0")
pds = PackageDepSpec("=cat/boo-1", PackageDepSpecParseMode.PERMISSIVE)
diff --git a/python/environment.cc b/python/environment.cc
index 1186b83..f344d1f 100644
--- a/python/environment.cc
+++ b/python/environment.cc
@@ -25,6 +25,7 @@
#include <paludis/environments/paludis/paludis_environment.hh>
#include <paludis/environments/paludis/paludis_config.hh>
#include <paludis/environments/no_config/no_config_environment.hh>
+#include <paludis/environments/test/test_environment.hh>
#include <paludis/package_id.hh>
using namespace paludis;
@@ -219,4 +220,16 @@ void PALUDIS_VISIBLE expose_environment()
"Should we accept unstable keywords?"
)
;
+
+ /**
+ * TestEnvironment
+ */
+ bp::class_<TestEnvironment, bp::bases<Environment>, boost::noncopyable>
+ (
+ "TestEnvironment",
+ "A TestEnvironment is an environment used during testing that lets us "
+ "control all the options rather than reading them from configuration files.",
+ bp::init<>("__init__()")
+ );
+
}
diff --git a/python/environment_TEST.py b/python/environment_TEST.py
index f438db6..82ea50b 100755
--- a/python/environment_TEST.py
+++ b/python/environment_TEST.py
@@ -141,6 +141,9 @@ class TestCase_02_AdaptedEnvironment(unittest.TestCase):
env.clear_adaptions()
self.assert_(env.query_use("enabled", pid))
+class TestCase_03_TestEnvironment(unittest.TestCase):
+ def test_01_create(self):
+ env = TestEnvironment()
if __name__ == "__main__":
unittest.main()