Unverified Commit f282ee30 authored by nv-dlasalle's avatar nv-dlasalle Committed by GitHub
Browse files

[bugfix] Fix set_default_backend() keyword (#3710)



* Add unit test

* Fix typo
Co-authored-by: default avatarJinjing Zhou <VoVAllen@users.noreply.github.com>
parent 35122075
......@@ -3,8 +3,7 @@ import os
import json
def set_default_backend(default_dir, backend_name):
# the exists_ok requires python >= 3.2
os.makedirs(default_dir, exists_ok=True)
os.makedirs(default_dir, exist_ok=True)
config_path = os.path.join(default_dir, 'config.json')
with open(config_path, "w") as config_file:
json.dump({'backend': backend_name.lower()}, config_file)
......
import backend as F
import os
import unittest
def test_set_default_backend():
default_dir = os.path.join(os.path.expanduser('~'), '.dgl_unit_test')
F.set_default_backend(default_dir, 'pytorch')
# make sure the config file was created
assert os.path.exists(os.path.join(default_dir, 'config.json'))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment