Skip to content
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

ability switch evaluated code environment to module #241

Open
machow opened this issue Dec 28, 2017 · 0 comments
Open

ability switch evaluated code environment to module #241

machow opened this issue Dec 28, 2017 · 0 comments

Comments

@machow
Copy link
Contributor

machow commented Dec 28, 2017

Currently, pythonwhat uses subprocesses for evaluated student / solution. For cases where a main script imports a custom module that is part of an exercise, it would be useful to set the module as the "environment". For example, in the code below we may want to check config, even if __main__.py is the script executed by the process.

__main__.py:

from app import app

app.py:

from somelibrary import load_config, Service

config = load_config(...)

app = Service(config)

SCT sketch

(Ex()
     .check_file('app.py')
     .set_module_env('app')     # exposes variables in module "app"
     .test_object('config')
     )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants