8000 gh-76785: Multiple Interpreters in the Stdlib (PEP 554) by nanjekyejoannah · Pull Request #18817 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-76785: Multiple Interpreters in the Stdlib (PEP 554) #18817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Lib/test/test_interpreters.py
Co-Authored-By: Eric Snow <ericsnowcurrently@gmail.com>
  • Loading branch information
nanjekyejoannah and ericsnowcurrently authored Sep 13, 2019
commit 80f680867593fd7562c642ed19881147006cdbba
38 changes: 38 additions & 0 deletions Lib/test/test_interpreters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,44 @@ def clean_up_interpreters():
pass # already destroyed


class LowLevelStub:
# set these as appropriate in tests
errors = ()
return_create = ()
...
def __init__(self):
self._calls = []
def _add_call(self, name, args=(), kwargs=None):
self.calls.append(
(name, args, kwargs or {}))
def _maybe_error(self):
if not self.errors:
return
err = self.errors.pop(0)
if err is not None:
raise err
def check_calls(self, test, expected):
test.assertEqual(self._calls, expected)
for returns in [self.errors, self.return_create, ...]:
test.assertEqual(tuple(returns), ()) # make sure all were used

# the stubbed methods
def create(self):
self._add_call('create')
self._maybe_error()
return self.return_create.pop(0)
def list_all(self):
...
def get_current(self):
...
def get_main(self):
...
def destroy(self, id):
...
def run_string(self, id, text, ...):
...


class TestBase(unittest.TestCase):

def tearDown(self):
Expand Down
0