about summary refs log tree commit diff
path: root/nixos/lib/testing-python.nix
diff options
context:
space:
mode:
authorDavid Arnold <dar@xoe.solutions>2021-06-06 13:50:02 -0500
committerDavid Arnold <dgx.arnold@gmail.com>2021-08-19 23:55:26 -0500
commitdb614e11d672cf8e3c1268d34e74e0c9981ab5be (patch)
treecf12e553455dfa05225da8eb5ec66ce082ff8222 /nixos/lib/testing-python.nix
parent5edf5b60c3d8f82b5fc5e73e822b6f7460584945 (diff)
nixos/tests/test-driver: better control test env symbols
Previous to this commit, the entire test driver environment was shared
with the actual python test environment.

This is a hefty api surface. This commit selectively exposes only those
symbols to the test environment that are actually meant to be used by
tests.
Diffstat (limited to 'nixos/lib/testing-python.nix')
-rw-r--r--nixos/lib/testing-python.nix4
1 files changed, 3 insertions, 1 deletions
diff --git a/nixos/lib/testing-python.nix b/nixos/lib/testing-python.nix
index e95ebe16ecac3..43b4f9b159b2f 100644
--- a/nixos/lib/testing-python.nix
+++ b/nixos/lib/testing-python.nix
@@ -42,7 +42,9 @@ rec {
         python <<EOF
         from pydoc import importfile
         with open('driver-symbols', 'w') as fp:
-          fp.write(','.join(dir(importfile('${testDriverScript}'))))
+          t = importfile('${testDriverScript}')
+          test_symbols = t._test_symbols()
+          fp.write(','.join(test_symbols.keys()))
         EOF
       '';