Skip to content

Instantly share code, notes, and snippets.

View gabrielfalcao's full-sized avatar
👨‍💻
probably writing tests

Gabriel Falcão gabrielfalcao

👨‍💻
probably writing tests
View GitHub Profile
gabriel@morena:~/Projetos/dead-parrot$ python setup.py test
running test
running egg_info
writing Dead_Parrot.egg-info/PKG-INFO
writing top-level names to Dead_Parrot.egg-info/top_level.txt
writing dependency_links to Dead_Parrot.egg-info/dependency_links.txt
reading manifest file 'Dead_Parrot.egg-info/SOURCES.txt'
writing manifest file 'Dead_Parrot.egg-info/SOURCES.txt'
running build_ext
test_relation_has_from_model_class_as_attribute (tests.test_relationships.TestForeignKey) ... ok
Traceback (most recent call last):
File "/usr/bin/pyccuracy_console", line 86, in <module>
main()
File "/usr/bin/pyccuracy_console", line 79, in main
should_throw=options.should_throw)
File "/var/lib/python-support/python2.5/pyccuracy/pyccuracy_core.py", line 182, in run_tests
results = self.context.story_runner.run_stories(self.context)
File "/var/lib/python-support/python2.5/pyccuracy/story_runner.py", line 46, in run_stories
self.__run_scenarios(current_story, context)
File "/var/lib/python-support/python2.5/pyccuracy/story_runner.py", line 65, in __run_scenarios
@gabrielfalcao
gabrielfalcao / gist:126019
Created June 8, 2009 19:53
My implementation of singleton
__SINGLETON_INSTANCES__ = {}
class Singleton(object):
def __new__(cls, *args, **kw):
key = cls.__name__, args, tuple(kw.values())
if key not in __SINGLETON_INSTANCES__.keys():
__SINGLETON_INSTANCES__[key] = super(type, cls).__new__(cls, *args, **kw)
return __SINGLETON_INSTANCES__[key]
@gabrielfalcao
gabrielfalcao / gist:146662
Created July 14, 2009 02:38
Metaclass example
class WooMeta(type):
def __init__(cls, name, bases, attrs):
names = [n for n in attrs.keys() if not n.startswith('_')]
cls._attributes = tuple(names)
super(WeeMeta, cls).__init__(name, bases, attrs)
class Wee(object):
__metaclass__ = WooMeta
foo = 1
zoo = 2
#!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# Copyright (C) 2009 Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
#!/bin/bash
if [ ! $USER == "root" ]; then
echo "You must be root to run this script!";
exit 1;
fi;
echo 'deb http://deb.gabrielfalcao.com/unstable ./' >> /etc/apt/sources.list
aptitude update
aptitude install python-pyccuracy
# -*- coding: utf-8 -*-
# Copyright (C) <2009> Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# -*- coding: utf-8 -*-
# Copyright (C) <2009> Gabriel Falcão <gabriel@nacaolivre.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@gabrielfalcao
gabrielfalcao / php output buffering
Created December 30, 2009 13:33
php output buffering
<?php
ob_start();
include("some_file.php");
$stdout = ob_get_contents();
ob_end_clean();
?>
#!/bin/sh
# Adium theme AdiumMessageStyle installer for Empathy
# Originally © 2009 Antono Vasiljev
# Licensed under the same terms as Empathy
# http://antono.info/en/165-install-adium-themes-to-empathy
# Changed by Vertlo Oraerk (did not work with directories containing spaces in the names)
if [ -z $1 ]
then
echo