Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed Oct 11, 2024
1 parent ea33c2f commit e301c6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions pyiron_base/project/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ def create_executable_job(
internal_job_name (str, optional): The name of the job. Defaults to None.
internal_execute_job (bool, optional): Whether to execute the job. Defaults to True.
internal_auto_rename (bool, optional): Whether to automatically rename the job. Defaults to False.
server_obj (Server): Server object to define the resource requirements for the executable
Returns:
Project: The project object.
Expand Down
11 changes: 10 additions & 1 deletion tests/unit/flex/test_executablecontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ def test_create_job_factory_no_functions(self):
),
job_name="job_no",
)
job.run()
job.server.cores = 2
self.assertEqual(job.server.cores, 2)
with self.assertWarns(RuntimeWarning):
# No multi core executable found falling back to the single core executable.
job.run()
self.assertEqual(job.server.cores, 1)
self.assertTrue("Python" in job.output["stdout"])
self.assertTrue(job.status.finished)
self.assertEqual(os.listdir(job.working_directory), ["error.out"])
Expand Down Expand Up @@ -291,7 +296,11 @@ def test_delayed_series_of_jobs(self):
nodes_dict, edges_lst = w.get_graph()
self.assertEqual(len(nodes_dict), 17)
self.assertEqual(len(edges_lst), 27)
w.server.cores = 2
self.assertEqual(w.server.cores, 2)
job_w = w.pull()
self.assertEqual(w.server.cores, 2)
self.assertEqual(job_w.server.cores, 1)
job_z = z.pull()
self.assertEqual(job_w.output.result, 7)
self.project.remove_job(job_z.job_name)
Expand Down

0 comments on commit e301c6d

Please sign in to comment.