summaryrefslogtreecommitdiffstats
path: root/extras/pytest.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-04-02 19:23:06 +0200
committerDavid Robillard <d@drobilla.net>2020-04-02 19:23:06 +0200
commitefdc5871d0ba68e364c2d7675a0b4b0965d0130c (patch)
tree9f51f3f918c14cc9194381b75d0d6993f45e4a1b /extras/pytest.py
parent4ad9fa89c873c232e48fe5b6ce40ca0fe2cac4a7 (diff)
downloadautowaf-efdc5871d0ba68e364c2d7675a0b4b0965d0130c.tar.gz
autowaf-efdc5871d0ba68e364c2d7675a0b4b0965d0130c.tar.bz2
autowaf-efdc5871d0ba68e364c2d7675a0b4b0965d0130c.zip
Update to waf 2.0.19
Diffstat (limited to 'extras/pytest.py')
-rw-r--r--extras/pytest.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/extras/pytest.py b/extras/pytest.py
index 7dd5a1a..fc9ad1c 100644
--- a/extras/pytest.py
+++ b/extras/pytest.py
@@ -40,6 +40,8 @@ the following environment variables for the `pytest` test runner:
- `pytest_libpath` attribute is used to manually specify additional linker paths.
+3. Java class search path (CLASSPATH) of any Java/Javalike dependency
+
Note: `pytest` cannot automatically determine the correct `PYTHONPATH` for `pyext` taskgens
because the extension might be part of a Python package or used standalone:
@@ -119,6 +121,7 @@ def pytest_process_use(self):
self.pytest_use_seen = []
self.pytest_paths = [] # strings or Nodes
self.pytest_libpaths = [] # strings or Nodes
+ self.pytest_javapaths = [] # strings or Nodes
self.pytest_dep_nodes = []
names = self.to_list(getattr(self, 'use', []))
@@ -157,6 +160,17 @@ def pytest_process_use(self):
extend_unique(self.pytest_dep_nodes, tg.source)
extend_unique(self.pytest_paths, [pypath.abspath()])
+ if 'javac' in tg.features:
+ # If a JAR is generated point to that, otherwise to directory
+ if getattr(tg, 'jar_task', None):
+ extend_unique(self.pytest_javapaths, [tg.jar_task.outputs[0].abspath()])
+ else:
+ extend_unique(self.pytest_javapaths, [tg.path.get_bld()])
+
+ # And add respective dependencies if present
+ if tg.use_lst:
+ extend_unique(self.pytest_javapaths, tg.use_lst)
+
if getattr(tg, 'link_task', None):
# For tasks with a link_task (C, C++, D et.c.) include their library paths:
if not isinstance(tg.link_task, ccroot.stlink_task):
@@ -212,8 +226,9 @@ def make_pytest(self):
Logs.debug("ut: %s: Adding paths %s=%s", self, var, lst)
self.ut_env[var] = os.pathsep.join(lst) + os.pathsep + self.ut_env.get(var, '')
- # Prepend dependency paths to PYTHONPATH and LD_LIBRARY_PATH
+ # Prepend dependency paths to PYTHONPATH, CLASSPATH and LD_LIBRARY_PATH
add_paths('PYTHONPATH', self.pytest_paths)
+ add_paths('CLASSPATH', self.pytest_javapaths)
if Utils.is_win32:
add_paths('PATH', self.pytest_libpaths)