Commit 2919389d by kimth

Use os.path.join -- all of them...

parent 7c5879a1
......@@ -295,7 +295,8 @@ class CodeResponseTest(unittest.TestCase):
Simple test of whether LoncapaProblem knows when it's been queued
'''
problem_file = os.path.join(os.path.dirname(__file__), "test_files/coderesponse.xml")
test_lcp = lcp.LoncapaProblem(open(problem_file).read(), '1', system=i4xs)
with open(problem_file) as input_file:
test_lcp = lcp.LoncapaProblem(input_file.read(), '1', system=i4xs)
answer_ids = sorted(test_lcp.get_question_answers().keys())
num_answers = len(answer_ids)
......@@ -321,7 +322,7 @@ class CodeResponseTest(unittest.TestCase):
'''
Test whether LoncapaProblem.update_score can deliver queued result to the right subproblem
'''
problem_file = os.path.dirname(__file__) + "/test_files/coderesponse.xml"
problem_file = os.path.join(os.path.dirname(__file__), "test_files/coderesponse.xml")
test_lcp = lcp.LoncapaProblem(open(problem_file).read(), '1', system=i4xs)
answer_ids = sorted(test_lcp.get_question_answers().keys())
......@@ -377,7 +378,7 @@ class CodeResponseTest(unittest.TestCase):
'''
Test whether the LoncapaProblem knows about the time of queue requests
'''
problem_file = os.path.dirname(__file__) + "/test_files/coderesponse.xml"
problem_file = os.path.join(os.path.dirname(__file__), "test_files/coderesponse.xml")
test_lcp = lcp.LoncapaProblem(open(problem_file).read(), '1', system=i4xs)
answer_ids = sorted(test_lcp.get_question_answers().keys())
......@@ -411,7 +412,7 @@ class CodeResponseTest(unittest.TestCase):
'''
Test whether file objects are converted to filenames without altering other structures
'''
problem_file = os.path.dirname(__file__) + "/test_files/coderesponse.xml"
problem_file = os.path.join(os.path.dirname(__file__), "test_files/coderesponse.xml")
fp = open(problem_file)
answers_with_file = {'1_2_1': 'String-based answer',
'1_3_1': ['answer1', 'answer2', 'answer3'],
......
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