{"action":"closed","issue":{"url":"https://api.github.com/repos/hylang/hy/issues/418","repository_url":"https://api.github.com/repos/hylang/hy","labels_url":"https://api.github.com/repos/hylang/hy/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/hylang/hy/issues/418/comments","events_url":"https://api.github.com/repos/hylang/hy/issues/418/events","html_url":"https://github.com/hylang/hy/issues/418","id":25100069,"number":418,"title":"__main__ is not handled correctly when a program is run with hy program.hy","user":{"login":"podhmo","id":80613,"avatar_url":"https://avatars.githubusercontent.com/u/80613?v=3","gravatar_id":"","url":"https://api.github.com/users/podhmo","html_url":"https://github.com/podhmo","followers_url":"https://api.github.com/users/podhmo/followers","following_url":"https://api.github.com/users/podhmo/following{/other_user}","gists_url":"https://api.github.com/users/podhmo/gists{/gist_id}","starred_url":"https://api.github.com/users/podhmo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/podhmo/subscriptions","organizations_url":"https://api.github.com/users/podhmo/orgs","repos_url":"https://api.github.com/users/podhmo/repos","events_url":"https://api.github.com/users/podhmo/events{/privacy}","received_events_url":"https://api.github.com/users/podhmo/received_events","type":"User","site_admin":false},"labels":[{"id":74028581,"url":"https://api.github.com/repos/hylang/hy/labels/AST-generation/bug","name":"AST-generation/bug","color":"eb6420","default":false},{"id":23529240,"url":"https://api.github.com/repos/hylang/hy/labels/backend","name":"backend","color":"02d7e1","default":false},{"id":23529248,"url":"https://api.github.com/repos/hylang/hy/labels/bug","name":"bug","color":"e10c02","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2014-01-06T12:55:11Z","updated_at":"2016-12-13T19:44:44Z","closed_at":"2016-12-13T19:44:44Z","body":"Maybe, the diferrence between hy and hyc is existed treating \"**main**\" module.  perhaps, this behavior is bug, but, I can't judge about it.\n\nwhen i try below code.\n\n``` lisp\n(import unittest)\n\n(defclass Tests [unittest.TestCase]\n  [[testIt (fn [self] (raise (Exception \"\")))]])\n\n(when (= --name-- \"__main__\")\n  (import sys)\n  (print (dir (get sys.modules \"__main__\")))\n\n  (.main unittest)\n  )\n```\n## Execution with hyc\n\nthis is expected behavior (Exception is raised).\n\n``` bash\n$ hyc assert-sample.hy\n$ python assert-sample.pyc\n\nE\n======================================================================\nERROR: testIt (__main__.Tests)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File \"assert-sample.hy\", line 4, in testIt\n    [[testIt (fn [self] (raise (Exception \"\")))]])\nException\n\n----------------------------------------------------------------------\nRan 1 test in 0.000s\n\nFAILED (errors=1)\n['Tests', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', 'sys', 'unittest']\n```\n## Execution with hy\n\nException is not raised.\n\n``` bash\n$ hy assert-sample.hy\n['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__requires__', 'load_entry_point', 'sys']\n\n----------------------------------------------------------------------\nRan 0 tests in 0.000s\n\nOK\n```\n"}}
{"actor":{"display_login":"Kodiologist"}}