Repository: gratipay/gratipay.com

Issue:
ImportError: cannot import name Participant
I get this when running some of the test scripts individually.



Discussion:
In particular, test_billing_payday.py, which I want for #1116.

`[gittip] $ for name in `ls test_*.py`; do echo $name >> log && foreman run -e env nosetests -s $name >> log 2>&1 && printf "\n\n\n" >> log; done`

```
test_billing.py
...............
----------------------------------------------------------------------
Ran 15 tests in 0.293s

OK



test_billing_payday.py
E
======================================================================
ERROR: Failure: ImportError (cannot import name Participant)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/whit537/personal/gittip/www.gittip.com/env/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/whit537/personal/gittip/www.gittip.com/env/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/whit537/personal/gittip/www.gittip.com/env/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/whit537/personal/gittip/www.gittip.com/tests/test_billing_payday.py", line 11, in <module>
    from gittip.billing.payday import FEE_CHARGE, Payday
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/billing/payday.py", line 27, in <module>
    from gittip.participant import Participant
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/participant.py", line 12, in <module>
    from gittip.models import community
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/models/__init__.py", line 4, in <module>
    from gittip.models.participant import Participant
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/models/participant.py", line 20, in <module>
    from gittip.participant import Participant as OldParticipant
ImportError: cannot import name Participant

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
test_elsewhere.py
.....
----------------------------------------------------------------------
Ran 5 tests in 0.158s

OK



test_elsewhere_github.py
.200 200 <!DOCTYPE html>
<html lang="en">

<head>

    <title>whit537 - Gittip</title>
    <meta http-equiv="content-language" content="en"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="/assets/reset.css"
            type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="/assets/9.4.5
-dev/gittip.css"
            type="text/css" charset="utf-8" />

    <!-- http://css-tricks.com/snippets/jquery/fallback-for-cdn-hosted-jquery/ -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script>
        if (typeof jQuery === 'undefined')
            document.write(unescape("%3Cscript src='/assets/jquery-1.8.3.min.js'%3E%3C/script%3E"));
    </script>

    <!-- Used on the profile edit page for the community chooser. -->
    <script src="/assets/chosen/chosen.jquery.min.js"></script>
    <style>@import url("/assets/chosen/chosen.css");</style>

    <script src="/assets/9.4.5
-dev/vendor/bootstrap-dropdown.js"></script>

    <script src="/assets/9.4.5
-dev/utils.js"></script>
    <script src="/assets/9.4.5
-dev/gittip.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/communities.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/forms.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/horn.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/jump.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/payments.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/tips.js"></script>
    <script>$(document).ready(Gittip.init);</script>

    <!-- start Mixpanel -->
    <script type="text/javascript">
        (function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!== typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a, e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
        mixpanel.init("cb9dec68ac0ee57071f0be39f164a417");

    </script>
    <!-- end Mixpanel -->




</head>
<body>
    <div class="main-padding"><div id="header">
        <table><tr><td class="logo">
            <h1>
                <a href="/">
                    <img src="/assets/9.4.5
-dev/logo.png" alt="Gittip" />
                </a>
            </h1>
            </td><td class="motto luxury">
            Distributed Genius Grants
        </td></tr></table>

          <div class="sign-in">
  <div class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Sign in <b class="caret"></b></a>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
      <li class="twitter">
        <a href="/on/twitter/redirect?action=opt-in&then=L29uL2dpdGh1Yi9ub3QtaW4tdGhlLWRiLw==">
          Twitter
        </a>
      </li>
      <li class="github">
        <a href="https://github.com/login/oauth/authorize?client_id=3785a9ac30df99feeef5&redirect_uri=http://localhost:8537/on/github/associate?data=b3B0LWluLC9vbi9naXRodWIvbm90LWluLXRoZS1kYi8=">
          GitHub
        </a>
      </li>
      <li class="bitbucket">
        <a href="/on/bitbucket/redirect?action=opt-in&then=L29uL2dpdGh1Yi9ub3QtaW4tdGhlLWRiLw==">
          Bitbucket
        </a>
      </li>
    </ul>
  </div>
</div>

    </div></div>

    <div id="hero">
        <div class="main-padding">
            <h2 class="top"><span>GitHub</span></h2>
        </div>
    </div>

    <div class="main-padding"><div id="box-page">

        <div class="box">


  <table class="on-elsewhere">
      <tr>
          <td class="picture">
              <img src="https://www.gravatar.com/avatar/fb054b407a6461e417ee6b6ae084da37.jpg?s=128" />
          </td>
          <td class="ready">
              <h2><a href="https://github.com/whit537">whit537</a> has</h2>
              <div class="number">0</div>

              <div class="unit">people
                ready to give</div>

          </td>
          <td class="offset"></td>
      </tr>
  </table>


    <div class="nav level-1">



        <h2>Your Weekly Pledge</h2>



        <div class="my-tip anon">
    <div class="tip-controls">
        <div class="tip-amount">
            $ <input type="number" class="my-tip" min="0" max="100" step="0.25" value="0" data-tippee="b3ab57171635" data-old-amount="0"> / week
        </div>

        <ul class="tip-suggestions">
            <li><a href="#">$100</a></li>
            <li><a href="#">$25</a></li>
            <li><a href="#">$10</a></li>
            <li><a href="#">$2</a></li>
            <li><a href="#" class="cents">25¢</a></li>
        </ul>
    </div>

    <div class="tip-actions">
        <button class="confirm-tip" disabled>Confirm</button><br>
        <a href="#" class="cancel-tip">Cancel</button>
    </div>
</div>


        <div class="help with-padding sign-in-to-give">
  <div class="sign-in">
  <div class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Sign in <b class="caret"></b></a>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
      <li class="twitter">
        <a href="/on/twitter/redirect?action=opt-in&then=L29uL2dpdGh1Yi9ub3QtaW4tdGhlLWRiLw==">
          Twitter
        </a>
      </li>
      <li class="github">
        <a href="https://github.com/login/oauth/authorize?client_id=3785a9ac30df99feeef5&redirect_uri=http://localhost:8537/on/github/associate?data=b3B0LWluLC9vbi9naXRodWIvbm90LWluLXRoZS1kYi8=">
          GitHub
        </a>
      </li>
      <li class="bitbucket">
        <a href="/on/bitbucket/redirect?action=opt-in&then=L29uL2dpdGh1Yi9ub3QtaW4tdGhlLWRiLw==">
          Bitbucket
        </a>
      </li>
    </ul>
  </div>
</div>
  to pledge
  to <b>whit537</b>.
</div>



</div>





        </div>

        <div id="page" class="group">



    <div class="col0">

        <script>$(document).ready(Gittip.tips.init);</script>

        <h2>Chad Whitacre has not joined Gittip.</h2>

        <p>Is this you?

        <a href="https://github.com/login/oauth/authorize?client_id=3785a9ac30df99feeef5&redirect_uri=http://localhost:8537/on/github/associate?data=b3B0LWluLHdoaXQ1Mzc=">Click
            here</a> to opt in to Gittip. We never collect money for you until
        you do.

        </p>


        <h2>What is Gittip?</h2>

        <p>Gittip is a way to thank and support your favorite artists,
        musicians, writers, programmers, etc. by setting up a small weekly cash
        gift to them. <a href="/about/">Read more ...</a></p>


        <h2>Don't like what you see?</h2>

        <p>If you are whit537 you can explicitly opt out of
        Gittip by locking this account. We don't allow new pledges to locked
        accounts.</p>

        <a href="https://github.com/login/oauth/authorize?client_id=3785a9ac30df99feeef5&redirect_uri=http://localhost:8537/on/github/associate?data=bG9jayx3aGl0NTM3"
            ><button>Lock</button></a>



    </div>


        </div>
    </div></div>

    <div class="main-padding"><div id="footer">
        <div class="social">
            <a href="https://twitter.com/gittip"><img src="/assets/icons/twitter.16.png" /></a>
        </div>
        <a href='http://blog.gittip.com/'>Blog</a> |
        <a href="/about/">About</a> |
        <a href="https://github.com/gittip/www.gittip.com">Source</a> |
        <a href='/about/faq.html'>FAQ</a> |
        <a href='/about/stats.html'>Stats</a> |
        <a href='/about/charts.html'>Charts</a> |
        <a href="/about/terms/">Terms</a> |
        <a href="/about/privacy/">Privacy</a> |
        <a href='/about/fraud/'>Fraud</a> |
        <a href='/security.txt'>Security</a>
    </div></div>

    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-247427-33']);
      _gaq.push(['_setDomainName', '.gittip.com']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>

    <script type="text/javascript">
      var _gauges = _gauges || [];
      (function() {
        var t   = document.createElement('script');
        t.type  = 'text/javascript';
        t.async = true;
        t.id    = 'gauges-tracker';
        t.setAttribute('data-site-id', '5162d97cf5a1f55905000083');
        t.src = '//secure.gaug.es/track.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(t, s);
      })();
    </script>

</div></body>
</html>

404 404 <!DOCTYPE html>
<html lang="en">

<head>

    <title>Gittip</title>
    <meta http-equiv="content-language" content="en"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="/assets/reset.css"
            type="text/css" charset="utf-8" />
    <link rel="stylesheet" href="/assets/9.4.5
-dev/gittip.css"
            type="text/css" charset="utf-8" />

    <!-- http://css-tricks.com/snippets/jquery/fallback-for-cdn-hosted-jquery/ -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script>
        if (typeof jQuery === 'undefined')
            document.write(unescape("%3Cscript src='/assets/jquery-1.8.3.min.js'%3E%3C/script%3E"));
    </script>

    <!-- Used on the profile edit page for the community chooser. -->
    <script src="/assets/chosen/chosen.jquery.min.js"></script>
    <style>@import url("/assets/chosen/chosen.css");</style>

    <script src="/assets/9.4.5
-dev/vendor/bootstrap-dropdown.js"></script>

    <script src="/assets/9.4.5
-dev/utils.js"></script>
    <script src="/assets/9.4.5
-dev/gittip.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/communities.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/forms.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/horn.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/jump.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/payments.js"></script>
    <script src="/assets/9.4.5
-dev/gittip/tips.js"></script>
    <script>$(document).ready(Gittip.init);</script>

    <!-- start Mixpanel -->
    <script type="text/javascript">
        (function(e,b){if(!b.__SV){var a,f,i,g;window.mixpanel=b;a=e.createElement("script");a.type="text/javascript";a.async=!0;a.src=("https:"===e.location.protocol?"https:":"http:")+'//cdn.mxpnl.com/libs/mixpanel-2.2.min.js';f=e.getElementsByTagName("script")[0];f.parentNode.insertBefore(a,f);b._i=[];b.init=function(a,e,d){function f(b,h){var a=h.split(".");2==a.length&&(b=b[a[0]],h=a[1]);b[h]=function(){b.push([h].concat(Array.prototype.slice.call(arguments,0)))}}var c=b;"undefined"!== typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);b._i.push([a, e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
        mixpanel.init("cb9dec68ac0ee57071f0be39f164a417");

    </script>
    <!-- end Mixpanel -->




</head>
<body>
    <div class="main-padding"><div id="header">
        <table><tr><td class="logo">
            <h1>
                <a href="/">
                    <img src="/assets/9.4.5
-dev/logo.png" alt="Gittip" />
                </a>
            </h1>
            </td><td class="motto luxury">
            Distributed Genius Grants
        </td></tr></table>

          <div class="sign-in">
  <div class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Sign in <b class="caret"></b></a>
    <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
      <li class="twitter">
        <a href="/on/twitter/redirect?action=opt-in&then=L29uL2dpdGh1Yi9ub3QtaW4tdGhlLWRiLw==">
          Twitter
        </a>
      </li>
      <li class="github">
        <a href="https://github.com/login/oauth/authorize?client_id=3785a9ac30df99feeef5&redirect_uri=http://localhost:8537/on/github/associate?data=b3B0LWluLC9vbi9naXRodWIvbm90LWluLXRoZS1kYi8=">
          GitHub
        </a>
      </li>
      <li class="bitbucket">
        <a href="/on/bitbucket/redirect?action=opt-in&then=L29uL2dpdGh1Yi9ub3QtaW4tdGhlLWRiLw==">
          Bitbucket
        </a>
      </li>
    </ul>
  </div>
</div>

    </div></div>

    <div id="hero">
        <div class="main-padding">

    <h2 class="top">
        <span>Page Not Found</span>
    </h2>

        </div>
    </div>

    <div class="main-padding"><div id="box-page">

        <div class="box">


<p class="as-content">
  Sorry, we can't find the page that you are searching for.
</p>

<div class="nav level-1"><a href="/"><button>Home</button></a></div>


        </div>

        <div id="page" class="group">

        </div>
    </div></div>

    <div class="main-padding"><div id="footer">
        <div class="social">
            <a href="https://twitter.com/gittip"><img src="/assets/icons/twitter.16.png" /></a>
        </div>
        <a href='http://blog.gittip.com/'>Blog</a> |
        <a href="/about/">About</a> |
        <a href="https://github.com/gittip/www.gittip.com">Source</a> |
        <a href='/about/faq.html'>FAQ</a> |
        <a href='/about/stats.html'>Stats</a> |
        <a href='/about/charts.html'>Charts</a> |
        <a href="/about/terms/">Terms</a> |
        <a href="/about/privacy/">Privacy</a> |
        <a href='/about/fraud/'>Fraud</a> |
        <a href='/security.txt'>Security</a>
    </div></div>

    <script type="text/javascript">

      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-247427-33']);
      _gaq.push(['_setDomainName', '.gittip.com']);
      _gaq.push(['_trackPageview']);

      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();

    </script>

    <script type="text/javascript">
      var _gauges = _gauges || [];
      (function() {
        var t   = document.createElement('script');
        t.type  = 'text/javascript';
        t.async = true;
        t.id    = 'gauges-tracker';
        t.setAttribute('data-site-id', '5162d97cf5a1f55905000083');
        t.src = '//secure.gaug.es/track.js';
        var s = document.getElementsByTagName('script')[0];
        s.parentNode.insertBefore(t, s);
      })();
    </script>

</div></body>
</html>

pid-12703 thread-140735312757120 (MainThread) Github api responded with 500: 
502 502 <html>
    <head>
        <title>502 Bad Gateway</title>
        <style>

            BODY {
                margin: 0;
                padding: 200px 0 0;
                text-align: center;
                font: normal 18pt/18pt Georgia, serif;
            }
            PRE {
                text-align: left;
                font: normal 10pt/12pt monospace;
                margin: 50px 200px 0;
            }
        </style>
    </head>
    <body>
        Bad gateway, program!
        <pre>GitHub lookup failed with 500.</pre>
    </body>
</html>

pid-12703 thread-140735312757120 (MainThread) Github api responded with 777: 
.
----------------------------------------------------------------------
Ran 2 tests in 0.168s

OK
502 502 <html>
    <head>
        <title>502 Bad Gateway</title>
        <style>

            BODY {
                margin: 0;
                padding: 200px 0 0;
                text-align: center;
                font: normal 18pt/18pt Georgia, serif;
            }
            PRE {
                text-align: left;
                font: normal 10pt/12pt monospace;
                margin: 50px 200px 0;
            }
        </style>
    </head>
    <body>
        Bad gateway, program!
        <pre>GitHub lookup failed with 777.</pre>
    </body>
</html>




test_elsewhere_twitter.py
.
----------------------------------------------------------------------
Ran 1 test in 0.075s

OK



test_fake_data.py
.
----------------------------------------------------------------------
Ran 1 test in 0.081s

OK



test_goal_json.py
..........
----------------------------------------------------------------------
Ran 10 tests in 0.676s

OK



test_is_suspicious.py
....
----------------------------------------------------------------------
Ran 4 tests in 0.209s

OK



test_pages.py
................
----------------------------------------------------------------------
Ran 16 tests in 1.364s

OK



test_participant.py
......................
----------------------------------------------------------------------
Ran 22 tests in 0.690s

OK



test_participant_model.py
..................................
----------------------------------------------------------------------
Ran 34 tests in 0.928s

OK



test_public_json.py
...........
----------------------------------------------------------------------
Ran 11 tests in 0.551s

OK



test_record_an_exchange.py
...........
----------------------------------------------------------------------
Ran 11 tests in 0.546s

OK



test_stats.py
E
======================================================================
ERROR: Failure: ImportError (cannot import name Participant)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/whit537/personal/gittip/www.gittip.com/env/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/whit537/personal/gittip/www.gittip.com/env/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/whit537/personal/gittip/www.gittip.com/env/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/whit537/personal/gittip/www.gittip.com/tests/test_stats.py", line 9, in <module>
    from gittip.billing.payday import Payday
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/billing/payday.py", line 27, in <module>
    from gittip.participant import Participant
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/participant.py", line 12, in <module>
    from gittip.models import community
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/models/__init__.py", line 4, in <module>
    from gittip.models.participant import Participant
  File "/Users/whit537/personal/gittip/www.gittip.com/gittip/models/participant.py", line 20, in <module>
    from gittip.participant import Participant as OldParticipant
ImportError: cannot import name Participant
-------------------- >> begin captured logging << --------------------
psycopg2: DEBUG: installed. Logging using Python logging module
--------------------- >> end captured logging << ---------------------

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
test_take.py
........
----------------------------------------------------------------------
Ran 8 tests in 0.317s

OK



test_tip_json.py
.
----------------------------------------------------------------------
Ran 1 test in 0.143s

OK



test_user.py
...............
----------------------------------------------------------------------
Ran 15 tests in 0.278s

OK



test_username_json.py
......
----------------------------------------------------------------------
Ran 6 tests in 0.278s

OK



```

`test_billing_payday.py`
`test_stats.py`


Resolving patch:
diff --git a/gittip/participant.py b/gittip/participant.py
--- a/gittip/participant.py
+++ b/gittip/participant.py
@@ -9,7 +9,6 @@
 from aspen import Response
 from aspen.utils import typecheck
 from psycopg2 import IntegrityError
-from gittip.models import community
 
 
 ASCII_ALLOWED_IN_USERNAME = set("0123456789"


Test patch: