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

Fix bug with attrs not being included, add test to detect it #404

Merged
merged 1 commit into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion client/cli/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
OK_ROOT = os.path.normpath(os.path.dirname(client.__file__))
CONFIG_NAME = 'config.ok'

EXTRA_PACKAGES = ['requests', 'coverage', 'certifi', 'urllib3', 'chardet', 'idna', 'pytutor', 'ast_scope']
EXTRA_PACKAGES = ['requests', 'coverage', 'certifi', 'urllib3', 'chardet', 'idna', 'pytutor', 'ast_scope', 'attr']

def abort(message):
print(message + ' Aborting', file=sys.stderr)
Expand Down
31 changes: 31 additions & 0 deletions tests/end_to_end/smoke_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import unittest
import tempfile
import subprocess
import json
import os
import shlex
import sys
Expand All @@ -27,6 +28,10 @@ def setUp(self):
self.directory = tempfile.TemporaryDirectory()
publish.package_client(self.directory.name)

def add_file(self, name, contents):
with open(os.path.join(self.directory.name, name), "w") as f:
f.write(contents)

def run_ok(self, *args):
command_line = SCRIPT.format(
envloc=shlex.quote(self.clean_env_dir.name),
Expand All @@ -49,3 +54,29 @@ def testUpdate(self):
stdout, stderr = self.run_ok("--update")
self.assertEqual(stderr, "")
self.assertRegex(stdout, "Current version: v[0-9.]+\nChecking for software updates...\nOK is up to date")

def testRunNoArgument(self):
self.add_file("test.ok", json.dumps(
{
"name": "Test Assignment",
"endpoint": "cal/cs61a/fa19/test",
"src": [
"test.py"
],
"tests": {
"test.py": "doctest"
},
"default_tests": [],
"protocols": [
"restore",
"file_contents",
"unlock",
"grading",
"analytics",
"backup"
]
}
))
stdout, stderr = self.run_ok("--local")
self.assertEqual(stderr, "")
self.assertRegex(stdout, ".*0 test cases passed! No cases failed.*")