diff options
author | Max Wittig <max.wittig95@gmail.com> | 2019-10-13 18:58:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-13 18:58:55 +0200 |
commit | ff808ee94a73d65802a21ff1350090885d4befd5 (patch) | |
tree | c67d4ea4fb9354814e0b670fd61bbb4a4b08a3a9 /gitlab/tests/test_gitlab.py | |
parent | 92ba0283b63e562e181061252787e0e46da83a29 (diff) | |
parent | d6419aa86d6ad385e15d685bf47242bb6c67653e (diff) | |
download | gitlab-ff808ee94a73d65802a21ff1350090885d4befd5.tar.gz |
Merge pull request #908 from derekschrock/todo-units-test
Remove warning about open files from test_todo()
Diffstat (limited to 'gitlab/tests/test_gitlab.py')
-rw-r--r-- | gitlab/tests/test_gitlab.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gitlab/tests/test_gitlab.py b/gitlab/tests/test_gitlab.py index bd968b1..835e035 100644 --- a/gitlab/tests/test_gitlab.py +++ b/gitlab/tests/test_gitlab.py @@ -673,14 +673,15 @@ class TestGitlab(unittest.TestCase): self.assertEqual(status.emoji, "thumbsup") def test_todo(self): - todo_content = open(os.path.dirname(__file__) + "/data/todo.json", "r").read() - json_content = json.loads(todo_content) + with open(os.path.dirname(__file__) + "/data/todo.json", "r") as json_file: + todo_content = json_file.read() + json_content = json.loads(todo_content) + encoded_content = todo_content.encode("utf-8") @urlmatch(scheme="http", netloc="localhost", path="/api/v4/todos", method="get") def resp_get_todo(url, request): headers = {"content-type": "application/json"} - content = todo_content.encode("utf-8") - return response(200, content, headers, None, 5, request) + return response(200, encoded_content, headers, None, 5, request) @urlmatch( scheme="http", |