Comments (2)
We generally follow pep guidelines for python coding - http://www.python.org/dev/peps/pep-0008/#imports - in this case the format is:
- standard library imports
- related third party imports
- local application/library specific imports
It's a decent opinion but if a module is missing I (hope) it would never be checked in so it wouldn't break. We'll keep the current formatting since it's internally consistent across all our code bases :)
from billy.
Actually, when a module is missing, surely tests will be broken, it only matters where and how it breaks it. For module level imports, the whole test module is broken. For function level imports, only specific cases are broken.
For instance:
import unittest
import foobar.moda
import foobar.modb
class TestFooBar(unittest.TestCase):
def test_case_a(self):
foobar.moda.func1()
def test_case_b(self):
foobar.modb.func3()
In above code, the whole testing module will raise ImportError, no test cases will be executed. Surely the test is broken, but it breaks everything. You cannot know details about how it breaks thing. When it is in function level
import unittest
class TestFooBar(unittest.TestCase):
def make_func1(self):
from foobar.moda import func1
return
def make_func3(self):
from foobar.modb import func3
return
def test_case_a(self):
func1 = self.make_func1()
func1()
def test_case_b(self):
func3 = self.make_func3()
func3()
In this case, when a module is missing, still, cases will be broken, but you can know exactly which cases are broken. This brings a lots of benefit. For example, you want to upgrade the foobar module to the latest one, but the API is changed, module name is changed as well. In that case, module import will break everything. You have no idea what kind of impact that upgrading will bring. But for function level imports, you can know exactly which tests are broken by these module name changes.
And for the formatting, I also keep pep8 style in my own code base, however, I see testing code as an exception. Testing servers a different purpose than common code, surely it should follow a different guideline.
You can read the testing code of pyramid to see how they do it
https://github.com/Pylons/pyramid/tree/master/pyramid/tests
from billy.
Related Issues (20)
- Make soft description can be changed by user
- Adjustments HOT 12
- Dogfooding HOT 6
- Generate End-of-Year invoice report for marketplaces
- Figure out a way to make Balanced works with Billy
- Reference Moonpig - A Billing System That Doesn't Suck HOT 1
- Package Billy using Omnibus HOT 2
- Will Billy be integrated into the Balanced dashboard? HOT 1
- appears_on_statement_as parameter for Billy transactions HOT 3
- Put micro-deposit verification logic into Billy
- PHP Client
- Use v1.1 Balanced API instead of v1.0
- Allow 127.0.0.1 and localhost to call API via XHR
- Change debit.succeeded event HOT 5
- Subscription with items
- Allow orders to be used from within Billy
- SSL Cert has expired HOT 5
- Add new status for subscriptions
- Send event when subscription is canceled
- Balanced Payments is shutting down
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from billy.