Skip to content
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
10 changes: 5 additions & 5 deletions src/amuse/test/amusetest.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ class TestDefaults(_Defaults):

@late
def temporarydir(self):
dirname=tempfile.mkdtemp()
print(("generating temporary dir for test results: {0}". format(dirname)))
dirname = tempfile.mkdtemp(dir="./")
print(f"generating temporary dir for test results: {dirname}")
return dirname

@options.option(sections=['test'])
Expand All @@ -317,7 +317,7 @@ def path_to_results(self):
test_results_dir = os.path.join(amuse_root_dir, self.name_of_testresults_directory)
if os.path.exists(test_results_dir):
try:
f = open(os.path.join(test_results_dir,'test.txt'),'w')
f = open(os.path.join(test_results_dir, 'test.txt'), 'w')
f.close()
return test_results_dir
except IOError as ex:
Expand All @@ -327,9 +327,9 @@ def path_to_results(self):

@options.option(sections=['test'])
def name_of_testresults_directory(self):
return 'test_results'
return self.temporarydir

@options.option(type='boolean',sections=['test'])
@options.option(type='boolean', sections=['test'])
def can_run_tests_to_compile_modules(self):
return True

Expand Down
24 changes: 12 additions & 12 deletions src/amuse/test/suite/core_tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from amuse import datamodel


class TestFileFormatProcessor(base.FileFormatProcessor):
class ForTestFileFormatProcessor(base.FileFormatProcessor):
"""
Save files in a test format

Expand All @@ -21,7 +21,7 @@ class TestFileFormatProcessor(base.FileFormatProcessor):

def __init__(self, filename=None, set=None, format=None):
base.FileFormatProcessor.__init__(self, filename, set, format)
TestFileFormatProcessor.instance = self
ForTestFileFormatProcessor.instance = self
self.stored = False

@base.format_option
Expand All @@ -44,24 +44,24 @@ def load(self):
class FrameworkTests(amusetest.TestCase):

def test1(self):
options = TestFileFormatProcessor.get_options()
options = ForTestFileFormatProcessor.get_options()
self.assertTrue('add_comma' in options)
self.assertTrue('save_fast' in options)
TestFileFormatProcessor.register()
ForTestFileFormatProcessor.register()
base.write_set_to_file(None, "test.txt", format="123")
self.assertEqual(TestFileFormatProcessor.instance.set, None)
self.assertEqual(TestFileFormatProcessor.instance.filename, "test.txt")
self.assertEqual(TestFileFormatProcessor.instance.format, "123")
self.assertTrue(TestFileFormatProcessor.instance.stored)
self.assertTrue(TestFileFormatProcessor.instance.add_comma)
self.assertEqual(ForTestFileFormatProcessor.instance.set, None)
self.assertEqual(ForTestFileFormatProcessor.instance.filename, "test.txt")
self.assertEqual(ForTestFileFormatProcessor.instance.format, "123")
self.assertTrue(ForTestFileFormatProcessor.instance.stored)
self.assertTrue(ForTestFileFormatProcessor.instance.add_comma)

def test2(self):
TestFileFormatProcessor.register()
ForTestFileFormatProcessor.register()
base.write_set_to_file(None, "test.txt", format="123", add_comma=False)
self.assertFalse(TestFileFormatProcessor.instance.add_comma)
self.assertFalse(ForTestFileFormatProcessor.instance.add_comma)

def test3(self):
TestFileFormatProcessor.register()
ForTestFileFormatProcessor.register()
documentation = base.write_set_to_file.__doc__
self.assertTrue("**123**,\n Save files in a test format" in documentation)

Expand Down
Loading