{"action":"created","comment":{"url":"https://api.github.com/repos/cyclus/cycamore/pulls/comments/22496496","id":22496496,"diff_hunk":"@@ -1,100 +1,329 @@\n #! /usr/bin/env python\n \n+from nose.tools import assert_equal, assert_true\n import os\n-import json\n-import hashlib\n-import urllib\n+import tables\n+import numpy as np\n import uuid\n-from nose.tools import assert_true\n-from nose import with_setup\n-\n-from cyclus_tools import run_cyclus, compare_determ, compare_nondeterm\n-\n-sim_files = {}\n-fetchdir = \"fetch\"\n-\n-def setup():\n-    global sim_files\n-    if not os.path.isdir(fetchdir): \n-        os.makedirs(fetchdir)\n-    with open(\"reflist.json\") as f:\n-        refs = json.load(f)\n-    cyclus_ref = refs[-1][\"cyclus-ref\"]\n-    cycamore_ref = refs[-1][\"cycamore-ref\"]\n-    refs = [r for r in refs \n-            if r[\"cyclus-ref\"] == cyclus_ref \n-            and r[\"cycamore-ref\"] == cycamore_ref]\n-    base_url = \"http://regtests.fuelcycle.org/\"\n-    for r in refs:\n-        fpath = os.path.join(fetchdir, r[\"fname\"])\n-        if not os.path.exists(fpath):\n-            try:\n-                urllib.urlretrieve(base_url+r[\"fname\"], fpath)\n-            except AttributeError: # try python 3.1+ api version\n-                urllib.request.urlretrieve(base_url+r[\"fname\"], fpath)\n-        h = hashlib.sha1()\n-        with open(fpath, \"rb\") as f: \n-            h.update(f.read())\n-        if h.hexdigest() != r[\"sha1-checksum\"]:\n-            raise RuntimeError(\"They tooks our data!!! All our rackspace are belong to them.\")\n-        sim_files[r[\"input-file\"]] = fpath\n+from helper import check_cmd, run_cyclus, table_exist, find_ids\n \n class TestRegression(object):\n+    \"\"\"A base class for all regression tests. A derived class is required for\n+    each new input file to be tested. Each derived class *must* declare an `inf`\n+    member in their `__ini__` function that points to the input file to be\n+    tested, e.g., `self.inf_ = ./path/to/my/input_file.xml. See below for\n+    examples.\n+    \"\"\"\n     def __init__(self):\n-        self.in_dir_ = \"../input\"\n-        self.tmp_files_ = {}        \n-        for root, dirs, files in os.walk(self.in_dir_):\n-            for f in files:\n-                self.tmp_files_[f] = str(uuid.uuid4()) + \".h5\"\n+        self.outf_ = str(uuid.uuid4()) + \".h5\"\n+        self.inf = None\n \n     def __del__(self):\n-        for inf, outf in self.tmp_files_.items():\n-            if os.path.isfile(outf):\n-                print(\"removing {0}\".format(outf))\n-                os.remove(outf)\n-                \n+        if os.path.isfile(self.outf_):\n+            print(\"removing {0}\".format(self.outf_))\n+            os.remove(self.outf_)\n+\n+    def setup(self):\n+        if not self.inf:\n+            raise TypeError((\"self.inf must be set in derived classes \"\n+                             \"to run regression tests.\"))\n+        run_cyclus(\"cyclus\", os.getcwd(), self.inf, self.outf_)        \n+\n+        with tables.open_file(self.outf_, mode=\"r\") as f:\n+            # Get specific tables and columns\n+            self.agent_entry = f.get_node(\"/AgentEntry\")[:]\n+            self.agent_exit = f.get_node(\"/AgentExit\")[:] if \"/AgentExit\" in f \\\n+                else None\n+            self.resources = f.get_node(\"/Resources\")[:]\n+            self.transactions = f.get_node(\"/Transactions\")[:]","path":"tests/test_regression.py","position":84,"original_position":84,"commit_id":"7975fb18ff67ba6d968cb089c0392b41b07a1a6b","original_commit_id":"7975fb18ff67ba6d968cb089c0392b41b07a1a6b","user":{"login":"rwcarlsen","id":1351242,"avatar_url":"https://avatars.githubusercontent.com/u/1351242?v=3","gravatar_id":"","url":"https://api.github.com/users/rwcarlsen","html_url":"https://github.com/rwcarlsen","followers_url":"https://api.github.com/users/rwcarlsen/followers","following_url":"https://api.github.com/users/rwcarlsen/following{/other_user}","gists_url":"https://api.github.com/users/rwcarlsen/gists{/gist_id}","starred_url":"https://api.github.com/users/rwcarlsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwcarlsen/subscriptions","organizations_url":"https://api.github.com/users/rwcarlsen/orgs","repos_url":"https://api.github.com/users/rwcarlsen/repos","events_url":"https://api.github.com/users/rwcarlsen/events{/privacy}","received_events_url":"https://api.github.com/users/rwcarlsen/received_events","type":"User","site_admin":false},"body":"We should add 'compositions' and `info` to the fetched tables.","created_at":"2015-01-05T22:54:59Z","updated_at":"2015-01-05T22:54:59Z","html_url":"https://github.com/cyclus/cycamore/pull/296#discussion_r22496496","pull_request_url":"https://api.github.com/repos/cyclus/cycamore/pulls/296","_links":{"self":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/comments/22496496"},"html":{"href":"https://github.com/cyclus/cycamore/pull/296#discussion_r22496496"},"pull_request":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/296"}}},"pull_request":{"url":"https://api.github.com/repos/cyclus/cycamore/pulls/296","id":26855490,"html_url":"https://github.com/cyclus/cycamore/pull/296","diff_url":"https://github.com/cyclus/cycamore/pull/296.diff","patch_url":"https://github.com/cyclus/cycamore/pull/296.patch","issue_url":"https://api.github.com/repos/cyclus/cycamore/issues/296","number":296,"state":"open","locked":false,"title":"Regredux","user":{"login":"gidden","id":1392657,"avatar_url":"https://avatars.githubusercontent.com/u/1392657?v=3","gravatar_id":"","url":"https://api.github.com/users/gidden","html_url":"https://github.com/gidden","followers_url":"https://api.github.com/users/gidden/followers","following_url":"https://api.github.com/users/gidden/following{/other_user}","gists_url":"https://api.github.com/users/gidden/gists{/gist_id}","starred_url":"https://api.github.com/users/gidden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gidden/subscriptions","organizations_url":"https://api.github.com/users/gidden/orgs","repos_url":"https://api.github.com/users/gidden/repos","events_url":"https://api.github.com/users/gidden/events{/privacy}","received_events_url":"https://api.github.com/users/gidden/received_events","type":"User","site_admin":false},"body":"This PR will likely require both @rwcarlsen's and @scopatz's eyes. The goal of this PR is to better inform and/or fix the error @rwcarlsen is seeing in cyclus/cyclus#1054. The approach taken was discussed by both @rwcarlsen and myself.\r\n\r\n@rwcarlsen was seeing Cycamore regression test errors on his Cyclus PR that were not at all evident. Further, regression test failures are very hard, if not impossible, to debug because the current approach provides no detailed failure information. Detailed failure information is difficult to provide given the current implementation.\r\n\r\nCommits fd75ff2 through 6cd462a refactor the regression tests to instead use a query-based approach. That is, invariants are identified and queries are executed. Failed queries are easily identified. This matches the approach currently taken in `test_growth.xml` and `test_dynamic_capacitated.xml`.\r\n\r\nCommit f5689be removes the (now old) associated regression framework (reflists, storing DBs, etc.). Related instructions should be updated. Note that this commit can easily be reverted in this is undesirable. I removed the framework because it was no longer needed for any regression tests, and we have historically removed supporting frameworks when the supported implementation is removed.\r\n\r\nCommits 28f25e0 and 4e24505 then move related regression tests into the single regression test module and update their implementation to match the test-fixture pattern established previously. \r\n\r\nI know there's a lot to look at here, but I'll highlight a net reduction of 910 lines of code.","created_at":"2015-01-05T22:17:49Z","updated_at":"2015-01-05T22:54:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b411cdfe54c77422a8f8aaa4bc6c6c1649967386","assignee":null,"milestone":{"url":"https://api.github.com/repos/cyclus/cycamore/milestones/13","labels_url":"https://api.github.com/repos/cyclus/cycamore/milestones/13/labels","id":879164,"number":13,"title":"v1.3","description":"","creator":{"login":"scopatz","id":320553,"avatar_url":"https://avatars.githubusercontent.com/u/320553?v=3","gravatar_id":"","url":"https://api.github.com/users/scopatz","html_url":"https://github.com/scopatz","followers_url":"https://api.github.com/users/scopatz/followers","following_url":"https://api.github.com/users/scopatz/following{/other_user}","gists_url":"https://api.github.com/users/scopatz/gists{/gist_id}","starred_url":"https://api.github.com/users/scopatz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scopatz/subscriptions","organizations_url":"https://api.github.com/users/scopatz/orgs","repos_url":"https://api.github.com/users/scopatz/repos","events_url":"https://api.github.com/users/scopatz/events{/privacy}","received_events_url":"https://api.github.com/users/scopatz/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":0,"state":"open","created_at":"2014-11-24T23:46:40Z","updated_at":"2015-01-05T22:20:17Z","due_on":"2015-03-01T06:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/cyclus/cycamore/pulls/296/commits","review_comments_url":"https://api.github.com/repos/cyclus/cycamore/pulls/296/comments","review_comment_url":"https://api.github.com/repos/cyclus/cycamore/pulls/comments/{number}","comments_url":"https://api.github.com/repos/cyclus/cycamore/issues/296/comments","statuses_url":"https://api.github.com/repos/cyclus/cycamore/statuses/7975fb18ff67ba6d968cb089c0392b41b07a1a6b","head":{"label":"gidden:regredux","ref":"regredux","sha":"7975fb18ff67ba6d968cb089c0392b41b07a1a6b","user":{"login":"gidden","id":1392657,"avatar_url":"https://avatars.githubusercontent.com/u/1392657?v=3","gravatar_id":"","url":"https://api.github.com/users/gidden","html_url":"https://github.com/gidden","followers_url":"https://api.github.com/users/gidden/followers","following_url":"https://api.github.com/users/gidden/following{/other_user}","gists_url":"https://api.github.com/users/gidden/gists{/gist_id}","starred_url":"https://api.github.com/users/gidden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gidden/subscriptions","organizations_url":"https://api.github.com/users/gidden/orgs","repos_url":"https://api.github.com/users/gidden/repos","events_url":"https://api.github.com/users/gidden/events{/privacy}","received_events_url":"https://api.github.com/users/gidden/received_events","type":"User","site_admin":false},"repo":{"id":4980333,"name":"cycamore","full_name":"gidden/cycamore","owner":{"login":"gidden","id":1392657,"avatar_url":"https://avatars.githubusercontent.com/u/1392657?v=3","gravatar_id":"","url":"https://api.github.com/users/gidden","html_url":"https://github.com/gidden","followers_url":"https://api.github.com/users/gidden/followers","following_url":"https://api.github.com/users/gidden/following{/other_user}","gists_url":"https://api.github.com/users/gidden/gists{/gist_id}","starred_url":"https://api.github.com/users/gidden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gidden/subscriptions","organizations_url":"https://api.github.com/users/gidden/orgs","repos_url":"https://api.github.com/users/gidden/repos","events_url":"https://api.github.com/users/gidden/events{/privacy}","received_events_url":"https://api.github.com/users/gidden/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gidden/cycamore","description":"The CYClus Additional Modules REpository","fork":true,"url":"https://api.github.com/repos/gidden/cycamore","forks_url":"https://api.github.com/repos/gidden/cycamore/forks","keys_url":"https://api.github.com/repos/gidden/cycamore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gidden/cycamore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gidden/cycamore/teams","hooks_url":"https://api.github.com/repos/gidden/cycamore/hooks","issue_events_url":"https://api.github.com/repos/gidden/cycamore/issues/events{/number}","events_url":"https://api.github.com/repos/gidden/cycamore/events","assignees_url":"https://api.github.com/repos/gidden/cycamore/assignees{/user}","branches_url":"https://api.github.com/repos/gidden/cycamore/branches{/branch}","tags_url":"https://api.github.com/repos/gidden/cycamore/tags","blobs_url":"https://api.github.com/repos/gidden/cycamore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gidden/cycamore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gidden/cycamore/git/refs{/sha}","trees_url":"https://api.github.com/repos/gidden/cycamore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gidden/cycamore/statuses/{sha}","languages_url":"https://api.github.com/repos/gidden/cycamore/languages","stargazers_url":"https://api.github.com/repos/gidden/cycamore/stargazers","contributors_url":"https://api.github.com/repos/gidden/cycamore/contributors","subscribers_url":"https://api.github.com/repos/gidden/cycamore/subscribers","subscription_url":"https://api.github.com/repos/gidden/cycamore/subscription","commits_url":"https://api.github.com/repos/gidden/cycamore/commits{/sha}","git_commits_url":"https://api.github.com/repos/gidden/cycamore/git/commits{/sha}","comments_url":"https://api.github.com/repos/gidden/cycamore/comments{/number}","issue_comment_url":"https://api.github.com/repos/gidden/cycamore/issues/comments/{number}","contents_url":"https://api.github.com/repos/gidden/cycamore/contents/{+path}","compare_url":"https://api.github.com/repos/gidden/cycamore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gidden/cycamore/merges","archive_url":"https://api.github.com/repos/gidden/cycamore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gidden/cycamore/downloads","issues_url":"https://api.github.com/repos/gidden/cycamore/issues{/number}","pulls_url":"https://api.github.com/repos/gidden/cycamore/pulls{/number}","milestones_url":"https://api.github.com/repos/gidden/cycamore/milestones{/number}","notifications_url":"https://api.github.com/repos/gidden/cycamore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gidden/cycamore/labels{/name}","releases_url":"https://api.github.com/repos/gidden/cycamore/releases{/id}","created_at":"2012-07-10T20:55:39Z","updated_at":"2014-12-15T23:31:46Z","pushed_at":"2015-01-05T22:28:11Z","git_url":"git://github.com/gidden/cycamore.git","ssh_url":"git@github.com:gidden/cycamore.git","clone_url":"https://github.com/gidden/cycamore.git","svn_url":"https://github.com/gidden/cycamore","homepage":"","size":5275,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"develop"}},"base":{"label":"cyclus:develop","ref":"develop","sha":"45e5fdec26f6906079d6b280af0509fb33f4da6e","user":{"login":"cyclus","id":1355686,"avatar_url":"https://avatars.githubusercontent.com/u/1355686?v=3","gravatar_id":"","url":"https://api.github.com/users/cyclus","html_url":"https://github.com/cyclus","followers_url":"https://api.github.com/users/cyclus/followers","following_url":"https://api.github.com/users/cyclus/following{/other_user}","gists_url":"https://api.github.com/users/cyclus/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclus/subscriptions","organizations_url":"https://api.github.com/users/cyclus/orgs","repos_url":"https://api.github.com/users/cyclus/repos","events_url":"https://api.github.com/users/cyclus/events{/privacy}","received_events_url":"https://api.github.com/users/cyclus/received_events","type":"Organization","site_admin":false},"repo":{"id":4973784,"name":"cycamore","full_name":"cyclus/cycamore","owner":{"login":"cyclus","id":1355686,"avatar_url":"https://avatars.githubusercontent.com/u/1355686?v=3","gravatar_id":"","url":"https://api.github.com/users/cyclus","html_url":"https://github.com/cyclus","followers_url":"https://api.github.com/users/cyclus/followers","following_url":"https://api.github.com/users/cyclus/following{/other_user}","gists_url":"https://api.github.com/users/cyclus/gists{/gist_id}","starred_url":"https://api.github.com/users/cyclus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyclus/subscriptions","organizations_url":"https://api.github.com/users/cyclus/orgs","repos_url":"https://api.github.com/users/cyclus/repos","events_url":"https://api.github.com/users/cyclus/events{/privacy}","received_events_url":"https://api.github.com/users/cyclus/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cyclus/cycamore","description":"The CYClus Additional Module REpository","fork":false,"url":"https://api.github.com/repos/cyclus/cycamore","forks_url":"https://api.github.com/repos/cyclus/cycamore/forks","keys_url":"https://api.github.com/repos/cyclus/cycamore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cyclus/cycamore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cyclus/cycamore/teams","hooks_url":"https://api.github.com/repos/cyclus/cycamore/hooks","issue_events_url":"https://api.github.com/repos/cyclus/cycamore/issues/events{/number}","events_url":"https://api.github.com/repos/cyclus/cycamore/events","assignees_url":"https://api.github.com/repos/cyclus/cycamore/assignees{/user}","branches_url":"https://api.github.com/repos/cyclus/cycamore/branches{/branch}","tags_url":"https://api.github.com/repos/cyclus/cycamore/tags","blobs_url":"https://api.github.com/repos/cyclus/cycamore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cyclus/cycamore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cyclus/cycamore/git/refs{/sha}","trees_url":"https://api.github.com/repos/cyclus/cycamore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cyclus/cycamore/statuses/{sha}","languages_url":"https://api.github.com/repos/cyclus/cycamore/languages","stargazers_url":"https://api.github.com/repos/cyclus/cycamore/stargazers","contributors_url":"https://api.github.com/repos/cyclus/cycamore/contributors","subscribers_url":"https://api.github.com/repos/cyclus/cycamore/subscribers","subscription_url":"https://api.github.com/repos/cyclus/cycamore/subscription","commits_url":"https://api.github.com/repos/cyclus/cycamore/commits{/sha}","git_commits_url":"https://api.github.com/repos/cyclus/cycamore/git/commits{/sha}","comments_url":"https://api.github.com/repos/cyclus/cycamore/comments{/number}","issue_comment_url":"https://api.github.com/repos/cyclus/cycamore/issues/comments/{number}","contents_url":"https://api.github.com/repos/cyclus/cycamore/contents/{+path}","compare_url":"https://api.github.com/repos/cyclus/cycamore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cyclus/cycamore/merges","archive_url":"https://api.github.com/repos/cyclus/cycamore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cyclus/cycamore/downloads","issues_url":"https://api.github.com/repos/cyclus/cycamore/issues{/number}","pulls_url":"https://api.github.com/repos/cyclus/cycamore/pulls{/number}","milestones_url":"https://api.github.com/repos/cyclus/cycamore/milestones{/number}","notifications_url":"https://api.github.com/repos/cyclus/cycamore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cyclus/cycamore/labels{/name}","releases_url":"https://api.github.com/repos/cyclus/cycamore/releases{/id}","created_at":"2012-07-10T12:41:38Z","updated_at":"2014-12-21T05:46:48Z","pushed_at":"2015-01-05T18:12:52Z","git_url":"git://github.com/cyclus/cycamore.git","ssh_url":"git@github.com:cyclus/cycamore.git","clone_url":"https://github.com/cyclus/cycamore.git","svn_url":"https://github.com/cyclus/cycamore","homepage":"","size":7189,"stargazers_count":8,"watchers_count":8,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":17,"mirror_url":null,"open_issues_count":17,"forks":17,"open_issues":17,"watchers":8,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/296"},"html":{"href":"https://github.com/cyclus/cycamore/pull/296"},"issue":{"href":"https://api.github.com/repos/cyclus/cycamore/issues/296"},"comments":{"href":"https://api.github.com/repos/cyclus/cycamore/issues/296/comments"},"review_comments":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/296/comments"},"review_comment":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/cyclus/cycamore/pulls/296/commits"},"statuses":{"href":"https://api.github.com/repos/cyclus/cycamore/statuses/7975fb18ff67ba6d968cb089c0392b41b07a1a6b"}}}}