Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Insight tests #509

merged 1 commit into from

4 participants


Adding tests for Insight. Was already closed, but not merged.

// @paulirish


Looks good. Silly question - is there a reason the test-insight file is empty?


@addyosmani This is just a personal pattern that I use for commits. Baby-steps, always. Even creating a file, I do a commit. If you need to revert, or change something, you'll see all the changes, step-by-step on your git log. :-)


@gnuwilliam git isn't cmd+s u know :P

Can you merge down the commits? We (I, I guess) prefer having a clean commit history.

But looks good to me otherwise.

@gnuwilliam gnuwilliam Adding test-insight file
Creating test for tracking code

Raising exception when no tracking_code is passed

Creating test for main

@sindresorhus Hahaha, you know I have some git troubles. :-P

Anyway, done! I did merged the commits.



@ebidel Hi Eric. Could you please review the tests? Then we can close the PR.



@ebidel ebidel merged commit 2558702 into yeoman:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 20, 2012
  1. @gnuwilliam

    Adding test-insight file

    gnuwilliam authored
    Creating test for tracking code
    Raising exception when no tracking_code is passed
    Creating test for main
This page is out of date. Refresh to see the latest.
Showing with 28 additions and 0 deletions.
  1. +3 −0  cli/bin/
  2. +25 −0 cli/test/
3  cli/bin/
@@ -31,6 +31,9 @@ class Analytics(object):
def __init__(self, tracking_code):
+ if not tracking_code:
+ raise Exception('No tracking code is given')
self.tracking_code = tracking_code
self.do_stats = True
25 cli/test/
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+import sys
+import unittest
+import os
+from yeomaninsight import main, Analytics
+class YeomanInsightTest(unittest.TestCase):
+ def test_init_should_error_when_no_tracking_code_is_passed(self):
+ self.assertRaises(Exception, Analytics, tracking_code='')
+ def test_main_should_error_when_arguments_are_less_than_two(self):
+ # temporally disables print function, because it's used on main.
+ # just to keep the tests output clean.
+ sys.stdout = open(os.devnull, 'w')
+ self.assertRaises(SystemExit, main, args='')
+ # restores print function.
+ sys.stdout = sys.__stdout__
+if __name__ == '__main__':
+ unittest.main()
Something went wrong with that request. Please try again.