diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-08-31 11:06:36 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2021-08-31 16:59:37 -0700 |
commit | 042016a5556010b94364fc90280287cf9355c13b (patch) | |
tree | 5cfe1db978c3ea0c2b614e8c662ee8243321d8cb /unittests/internaltests.py | |
parent | 8d92e6d865e2a03875c29d2e2aa131ce774a5d5d (diff) | |
download | meson-042016a5556010b94364fc90280287cf9355c13b.zip meson-042016a5556010b94364fc90280287cf9355c13b.tar.gz meson-042016a5556010b94364fc90280287cf9355c13b.tar.bz2 |
unittests: add a test to Interpreter is unpicklable
We want this, so let's test it.
Diffstat (limited to 'unittests/internaltests.py')
-rw-r--r-- | unittests/internaltests.py | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/unittests/internaltests.py b/unittests/internaltests.py index 07643ed..0f2af18 100644 --- a/unittests/internaltests.py +++ b/unittests/internaltests.py @@ -12,17 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. +from configparser import ConfigParser +from pathlib import Path +from unittest import mock import contextlib +import io +import json +import operator +import os +import pickle import stat import subprocess -import json import tempfile -import os -import io -import operator -from unittest import mock -from configparser import ConfigParser -from pathlib import Path import typing as T import unittest @@ -1517,3 +1518,12 @@ class InternalTests(unittest.TestCase): with self.subTest(test, has_define=True), mock_trial(test): actual = mesonbuild.environment.detect_cpu({}) self.assertEqual(actual, expected) + + def test_interpreter_unpicklable(self) -> None: + build = mock.Mock() + build.environment = mock.Mock() + build.environment.get_source_dir = mock.Mock(return_value='') + with mock.patch('mesonbuild.interpreter.Interpreter._redetect_machines', mock.Mock()), \ + self.assertRaises(Exception): + i = mesonbuild.interpreter.Interpreter(build, mock=True) + pickle.dumps(i) |