{"action":"created","issue":{"url":"https://api.github.com/repos/ganga-devs/ganga/issues/180","repository_url":"https://api.github.com/repos/ganga-devs/ganga","labels_url":"https://api.github.com/repos/ganga-devs/ganga/issues/180/labels{/name}","comments_url":"https://api.github.com/repos/ganga-devs/ganga/issues/180/comments","events_url":"https://api.github.com/repos/ganga-devs/ganga/issues/180/events","html_url":"https://github.com/ganga-devs/ganga/issues/180","id":132158726,"number":180,"title":"Clean up import ganga code and start using this in tests","user":{"login":"drmarkwslater","id":13677368,"avatar_url":"https://avatars.githubusercontent.com/u/13677368?v=3","gravatar_id":"","url":"https://api.github.com/users/drmarkwslater","html_url":"https://github.com/drmarkwslater","followers_url":"https://api.github.com/users/drmarkwslater/followers","following_url":"https://api.github.com/users/drmarkwslater/following{/other_user}","gists_url":"https://api.github.com/users/drmarkwslater/gists{/gist_id}","starred_url":"https://api.github.com/users/drmarkwslater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drmarkwslater/subscriptions","organizations_url":"https://api.github.com/users/drmarkwslater/orgs","repos_url":"https://api.github.com/users/drmarkwslater/repos","events_url":"https://api.github.com/users/drmarkwslater/events{/privacy}","received_events_url":"https://api.github.com/users/drmarkwslater/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ganga-devs/ganga/labels/Core","name":"Core","color":"d4c5f9"},{"url":"https://api.github.com/repos/ganga-devs/ganga/labels/enhancement","name":"enhancement","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"drmarkwslater","id":13677368,"avatar_url":"https://avatars.githubusercontent.com/u/13677368?v=3","gravatar_id":"","url":"https://api.github.com/users/drmarkwslater","html_url":"https://github.com/drmarkwslater","followers_url":"https://api.github.com/users/drmarkwslater/followers","following_url":"https://api.github.com/users/drmarkwslater/following{/other_user}","gists_url":"https://api.github.com/users/drmarkwslater/gists{/gist_id}","starred_url":"https://api.github.com/users/drmarkwslater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drmarkwslater/subscriptions","organizations_url":"https://api.github.com/users/drmarkwslater/orgs","repos_url":"https://api.github.com/users/drmarkwslater/repos","events_url":"https://api.github.com/users/drmarkwslater/events{/privacy}","received_events_url":"https://api.github.com/users/drmarkwslater/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2016-02-08T14:39:01Z","updated_at":"2016-02-08T16:21:40Z","closed_at":null,"body":"After discussions with @milliams we think it would be good to get the little ganga stuff properly cleaned up and understood so we can then know exactly what's done at startup. In addition, the exit handlers should be able to be run independently of the atexit versions. We can then have tests such as:\r\n\r\n```python\r\nclass TestStartup(unittest.TestCase):\r\n   @safe_shutdown    # decorator to run proper shutdown code\r\n   def test_startup_submit(self):\r\n      from ganga import *\r\n      j = Job()\r\n      j.submit()\r\n      monitorUntilCompleted(j)    # Or something similar\r\n   \r\n   # Note: Don't care about the shutdown here so no decorator\r\n   def test_checkjob_persist(self):\r\n      from ganga import *\r\n      assertEqual(len(jobs), 1)\r\n```\r\n\r\nThis will do away with all the GangaTestCase stuff, be much closer (~the same) as what user will actually do and as a by product, I may be able to clean up the bootstrap code :)"},"comment":{"url":"https://api.github.com/repos/ganga-devs/ganga/issues/comments/181447497","html_url":"https://github.com/ganga-devs/ganga/issues/180#issuecomment-181447497","issue_url":"https://api.github.com/repos/ganga-devs/ganga/issues/180","id":181447497,"user":{"login":"drmarkwslater","id":13677368,"avatar_url":"https://avatars.githubusercontent.com/u/13677368?v=3","gravatar_id":"","url":"https://api.github.com/users/drmarkwslater","html_url":"https://github.com/drmarkwslater","followers_url":"https://api.github.com/users/drmarkwslater/followers","following_url":"https://api.github.com/users/drmarkwslater/following{/other_user}","gists_url":"https://api.github.com/users/drmarkwslater/gists{/gist_id}","starred_url":"https://api.github.com/users/drmarkwslater/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drmarkwslater/subscriptions","organizations_url":"https://api.github.com/users/drmarkwslater/orgs","repos_url":"https://api.github.com/users/drmarkwslater/repos","events_url":"https://api.github.com/users/drmarkwslater/events{/privacy}","received_events_url":"https://api.github.com/users/drmarkwslater/received_events","type":"User","site_admin":false},"created_at":"2016-02-08T16:21:40Z","updated_at":"2016-02-08T16:21:40Z","body":"@rob-c I just mean that we can run the Shutdown 'manually'. In the example above, you wouldn't get a full tearDown because the atexit stuff isn't being called so the decorator would supply that in whatever way is currently done when the `atexit` handlers **are** called. I realise this is something that GangaTestCase does do in theory but it seems that is having problems and also that would be the only reason to keep GangaTestCase over the normal Python test stuff. If the Ganga shutdown code can be in one (and only one) place and just called when needed in a test, then we should be able to simplify things.\r\n\r\nNow, the point about doing a full shutdown after every test is up for debate. Personally, I feel that most (but certainly not all) tests don't need the full shutdown and in fact shouldn't care about it. If all you want to do is some unit tests or basic GPI tests, you shouldn't need to fully shutdown everything. However, I can see a reason for doing this as well. Anyway, none of this is happening soon anyway so we can discuss and come to a consensus.\r\n\r\n"}}