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

Make test functions get access to global variables #837

Closed
muhangao opened this issue Sep 8, 2024 · 4 comments
Closed

Make test functions get access to global variables #837

muhangao opened this issue Sep 8, 2024 · 4 comments
Labels
question Further information is requested

Comments

@muhangao
Copy link

muhangao commented Sep 8, 2024

I'm writing test functions for autograder using OK Test format. However, for some functions, there're variable not defined error.

I tried to define them again in the test['setup'], and it's not working. I'm wondering is there any way to make test functions get access to global variables?

@muhangao muhangao added the question Further information is requested label Sep 8, 2024
@muhangao
Copy link
Author

muhangao commented Sep 8, 2024

Never mind, after adding nltk.download('punkt_tab') everything works.

@muhangao muhangao closed this as completed Sep 8, 2024
@chrispyles
Copy link
Member

Just adding info for the benefit of anyone who comes across this issue:

Otter does not support sharing variables declared in tests across test cases; there is an open FR for this (#426) but it is not currently planned. Otter also does not support all fields of the OK test format (including setup and teardown).

@muhangao
Copy link
Author

muhangao commented Sep 8, 2024

Let me make sure I understand: So can the test function gain access to variables created by students?

@chrispyles
Copy link
Member

Yes, anything declared in the student code should be accessible, you just can’t share variables between test cases that aren’t in the student code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants