{"id":471,"date":"2016-02-23T01:41:42","date_gmt":"2016-02-22T16:41:42","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2016\/02\/23\/pydev_django_19\/"},"modified":"2016-02-23T01:41:42","modified_gmt":"2016-02-22T16:41:42","slug":"pydev_django_19","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2016\/02\/23\/pydev_django_19\/","title":{"rendered":"PyDev \u3067 Django 1.9 \u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u304c\u5931\u6557\u3059\u308b\u5bfe\u7b56"},"content":{"rendered":"<h2 align=\"left\">1.PyDev + Django1.9 \u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3067\u3001DjangoTestSuiteRunner \u304c\u30a4\u30f3\u30dd\u30fc\u30c8\u51fa\u6765\u306a\u3044\u30a8\u30e9\u30fc<\/h2>\n<p align=\"left\"><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2016\/02\/21\/aws_elastic_beanstalk_\">\u304a\u6c17\u306b\u5165\u308a\u306e\u3001Eclipse + PyDev \u3067\u3001Django 1.9 \u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3002<\/a><\/p>\n<p> <a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/4873117569\/ref=as_li_ss_il?ie=UTF8&amp;camp=247&amp;creative=7399&amp;creativeASIN=4873117569&amp;linkCode=as2&amp;tag=typea09-22\" rel=\"nofollow\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=4873117569&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"border-top-style: none !important; border-left-style: none !important; border-bottom-style: none !important; border-right-style: none !important; margin: 0px\" border=\"0\" alt=\"\" src=\"http:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=4873117569\" width=\"1\" height=\"1\" \/>   <\/p>\n<p>\u3061\u3087\u3063\u3068\u3001\u30ed\u30b8\u30c3\u30af\u3092\u66f8\u304d\u59cb\u3081\u3088\u3046\u3068\u3001\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u6e96\u5099\u3092\u3057\u305f\u3089\u3089\u3089\u3001\u3001\u3001<\/p>\n<p>DjangoTestSuiteRunner \u304c\u30a4\u30f3\u30dd\u30fc\u30c8\u51fa\u6765\u306a\u3044\u3002\u3080\u3080\u3002<\/p>\n<pre class=\"prettyprint linenums\">Finding files... done.\r\nImporting test modules ... done.\r\nTraceback (most recent call last):\r\n  File &quot;C:\\Programs\\eclipse_mars_pydev\\plugins\\org.python.pydev_4.5.4.201601292234\\pysrc\\runfiles.py&quot;, line 238, in <module>\r\n    main()\r\n  File &quot;C:\\Programs\\eclipse_mars_pydev\\plugins\\org.python.pydev_4.5.4.201601292234\\pysrc\\runfiles.py&quot;, line 89, in main\r\n    return pydev_runfiles.main(configuration)  # Note: still doesn't return a proper value.\r\n  File &quot;C:\\Programs\\eclipse_mars_pydev\\plugins\\org.python.pydev_4.5.4.201601292234\\pysrc\\_pydev_runfiles\\pydev_runfiles.py&quot;, line 835, in main\r\n    PydevTestRunner(configuration).run_tests()\r\n  File &quot;C:\\Programs\\eclipse_mars_pydev\\plugins\\org.python.pydev_4.5.4.201601292234\\pysrc\\_pydev_runfiles\\pydev_runfiles.py&quot;, line 793, in run_tests\r\n    MyDjangoTestSuiteRunner(run_tests).run_tests([])\r\n  File &quot;C:\\Programs\\eclipse_mars_pydev\\plugins\\org.python.pydev_4.5.4.201601292234\\pysrc\\_pydev_runfiles\\pydev_runfiles.py&quot;, line 813, in run_tests\r\n    raise AssertionError(&quot;Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.&quot;)\r\nAssertionError: Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.<\/pre>\n<p>&#160;<\/p>\n<p>\u5358\u7d14\u306b\u767a\u751f\u7b87\u6240\u3092\u898b\u308b\u3068\u3001\u539f\u56e0\u306f\u3001PyDev \u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u3088\u3046\u3060\u3002<\/p>\n<p>File &quot;C:\\Programs\\eclipse_mars_pydev\\plugins\\org.python.pydev_4.5.4.201601292234\\pysrc\\_pydev_runfiles\\pydev_runfiles.py&quot;, line 813, in run_tests<\/p>\n<p>&#160;<\/p>\n<p>\u5b9f\u884c\u3059\u308b\u5185\u5bb9\u306f\u30c6\u30b9\u30c8\u30b1\u30fc\u30b9\u306e\u3072\u306a\u5f62\u306b\u3057\u3088\u3046\u3068\u601d\u3063\u3066\u3044\u308b\u5358\u7d14\u306a\u3082\u306e\u3002<\/p>\n<pre class=\"prettyprint linenums\"># -*- encoding:utf-8 -*-\r\nfrom django.conf import settings\r\nfrom django.test import TestCase\r\nimport django\r\n\r\n# DJANGO SETTING UP!\r\ndjango.setup()\r\n\r\nclass TemplateTest(TestCase):\r\n    '''\r\n    '''\r\n    @staticmethod\r\n    def setUpClass():\r\n        pass\r\n        \r\n    def test_template(self):\r\n        print 'template'<\/pre>\n<p>Django 1.7 \u306e\u6642\u306f\u554f\u984c\u306a\u304f\u52d5\u3044\u3066\u3044\u305f\u3002<\/p>\n<h2>2.\u539f\u56e0 Django 1.8 \u3067\u3001DjangoTestSuiteRunner \u306f\u5ec3\u6b62\u3055\u308c\u305f\uff01<\/h2>\n<p><a title=\"https:\/\/docs.djangoproject.com\/en\/1.9\/internals\/deprecation\/\" href=\"https:\/\/docs.djangoproject.com\/en\/1.9\/internals\/deprecation\/\">https:\/\/docs.djangoproject.com\/en\/1.9\/internals\/deprecation\/<\/a><\/p>\n<p>\u3069\u3046\u3084\u3089\u3001django.test.simple.DjangoTestSuiteRunner \u306f\u3001Django 1.8 \u3067\u5ec3\u6b62\u3055\u308c\u3001django.test.runner.DiscoverRunner \u306b\u7f6e\u304d\u63db\u308f\u3063\u305f\u306e\u304c\u539f\u56e0\u3001\u3067\u3001\u307e\u3060PyDev\u306f\u304a\u3063\u3064\u3044\u3066\u3044\u306a\u3044\u3068\u3002<\/p>\n<p><font color=\"#ff0000\" size=\"5\">\u5927\u5909\u56f0\u308b\uff01<\/font><\/p>\n<p>\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4e0a\u8a18\u30b9\u30bf\u30c3\u30af\u30c8\u30ec\u30fc\u30b9\u306e\u5f53\u8a72\u30d5\u30a1\u30a4\u30eb\u3092\u76f4\u63a5\u7de8\u96c6\u3057\u3001\u30af\u30e9\u30b9\u3092 django.test.runner.DiscoverRunner \u306b\u7f6e\u304d\u63db\u3048\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/PyDev--Django-1.9-_1392\/djnago_pydev_unittest.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"djnago_pydev_unittest\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"djnago_pydev_unittest\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/PyDev--Django-1.9-_1392\/djnago_pydev_unittest_thumb.jpg\" width=\"504\" height=\"175\" \/><\/a><\/p>\n<p>\u5177\u4f53\u7684\u306f\u3001805 \u884c\u76ee\u3042\u305f\u308a\u304b\u3089\u3001\u4ee5\u4e0b\u306e3\u30ab\u6240<\/p>\n<pre class=\"prettyprint linenums\">  \uff1a\r\ntry:\r\n    #from django.test.simple import DjangoTestSuiteRunner \u6b21\u884c\u306b\u7f6e\u304d\u63db\u3048\r\n    from django.test.runner import DiscoverRunner\r\nexcept:\r\n    class DjangoTestSuiteRunner:\r\n        def __init__(self):\r\n            pass\r\n\r\n        def run_tests(self, *args, **kwargs):\r\n            raise AssertionError(&quot;Unable to run suite with DjangoTestSuiteRunner because it couldn't be imported.&quot;)\r\n\r\n#class MyDjangoTestSuiteRunner(DjangoTestSuiteRunner): \u6b21\u884c\u306b\u7f6e\u304d\u63db\u3048\r\nclass MyDjangoTestSuiteRunner(DiscoverRunner):\r\n\r\n    def __init__(self, on_run_suite):\r\n        #DjangoTestSuiteRunner.__init__(self) \u6b21\u884c\u306b\u7f6e\u304d\u63db\u3048\r\n        DiscoverRunner.__init__(self)\r\n        self.on_run_suite = on_run_suite\r\n  \uff1a<\/pre>\n<h2>3.\u6210\u529f<\/h2>\n<p>\u5b9f\u884c\u3057\u3066\u307f\u305f\u3089\u3001\u30c6\u30b9\u30c8\u51fa\u6765\u307e\u3057\u305f\u3002<\/p>\n<p>\u3088\u304b\u3063\u305f\u3088\u304b\u3063\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/PyDev--Django-1.9-_1392\/djnago_pydev_unittest_success.jpg\"><img loading=\"lazy\" decoding=\"async\" title=\"djnago_pydev_unittest_success\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"djnago_pydev_unittest_success\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/PyDev--Django-1.9-_1392\/djnago_pydev_unittest_success_thumb.jpg\" width=\"470\" height=\"99\" \/><\/a><\/p>\n<p><a href=\"http:\/\/www.amazon.co.jp\/gp\/product\/B00XZTYMG6\/ref=as_li_ss_il?ie=UTF8&amp;camp=247&amp;creative=7399&amp;creativeASIN=B00XZTYMG6&amp;linkCode=as2&amp;tag=typea09-22\" rel=\"nofollow\"><img decoding=\"async\" border=\"0\" src=\"http:\/\/ws-fe.amazon-adsystem.com\/widgets\/q?_encoding=UTF8&amp;ASIN=B00XZTYMG6&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=JP&amp;ServiceVersion=20070822&amp;WS=1&amp;tag=typea09-22\" \/><\/a><img loading=\"lazy\" decoding=\"async\" style=\"border-top-style: none !important; border-left-style: none !important; border-bottom-style: none !important; border-right-style: none !important; margin: 0px\" border=\"0\" alt=\"\" src=\"http:\/\/ir-jp.amazon-adsystem.com\/e\/ir?t=typea09-22&amp;l=as2&amp;o=9&amp;a=B00XZTYMG6\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.PyDev + Django1.9 \u306e\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u3067\u3001DjangoTestSuiteRunner \u304c\u30a4\u30f3\u30dd\u30fc\u30c8\u51fa\u6765\u306a\u3044\u30a8\u30e9\u30fc \u304a\u6c17\u306b\u5165\u308a\u306e\u3001Eclipse + PyDev \u3067\u3001Django 1.9 \u306e\u74b0\u5883\u3092\u69cb\u7bc9\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[29,18,20],"tags":[],"class_list":["post-471","post","type-post","status-publish","format-standard","hentry","category-django","category-pydev","category-python"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=471"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/471\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}