Skip to content

Commit baf8902

Browse files
authored
Update tests (#624)
Convert the test script to actual unit tests. http://b/358191743
1 parent 9a57da9 commit baf8902

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/unit_tests.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
# KAGGLE_KEY=local_api_token
3333
# KAGGLE_USERNAME=<kaggle-user-name>
3434

35+
# Add those envars to the Python Tests>Unittest template to
36+
# make running individual tests easier.
37+
3538
test_user = api.config_values['username']
3639
model_title = 'testing'
3740
instance_name = 'test'
@@ -55,7 +58,7 @@ def tearDownModule():
5558
if os.path.exists(file):
5659
os.remove(file)
5760
file = os.path.join(kernel_directory, api.KERNEL_METADATA_FILE)
58-
if os.path.exists:
61+
if os.path.exists(file):
5962
os.remove(file)
6063
file = os.path.join(model_directory, api.MODEL_METADATA_FILE)
6164
if os.path.exists(file):
@@ -285,7 +288,7 @@ def test_kernels_g_pull(self):
285288

286289
# Competitions
287290

288-
def test_competitions_a_list(self):
291+
def test_competition_a_list(self):
289292
try:
290293
competitions = api.competitions_list()
291294
self.assertGreater(len(competitions), 0) # Assuming there should be some competitions
@@ -335,6 +338,7 @@ def test_competition_f_download_files(self):
335338
try:
336339
api.competition_download_files(competition)
337340
self.assertTrue(os.path.exists(f'{competition}.zip'))
341+
self.assertTrue(os.path.getsize(f'{competition}.zip') > 0)
338342
except ApiException as e:
339343
self.fail(f"competition_download_files failed: {e}")
340344
finally:

0 commit comments

Comments
 (0)