Skip to content
Browse files

make pytest ignore venv directory which is present in circleci by def…

…ault
  • Loading branch information...
1 parent 844bfae commit 91d425dc2744fe7c2d0d879d316604fa8785c94e @bear committed Mar 15, 2016
Showing with 7 additions and 29 deletions.
  1. +2 −0 pytest.ini
  2. +1 −25 setup.py
  3. +4 −4 tests/test_api.py
View
2 pytest.ini
@@ -0,0 +1,2 @@
+[pytest]
+norecursedirs = venv
View
26 setup.py
@@ -18,37 +18,13 @@
# limitations under the License.
import os
-import sys
import re
import codecs
from setuptools import setup, find_packages
-from setuptools.command.test import test as TestCommand
-cwd = os.path.abspath(os.path.dirname(__file__))
-
-class PyTest(TestCommand):
- """You can pass a single string of arguments using the
- --pytest-args or -a command-line option:
- python setup.py test -a "--durations=5"
- is equivalent to running:
- py.test --durations=5
- """
- user_options = [('pytest-args=', 'a', 'Arguments to pass to py.test')]
-
- def initialize_options(self):
- TestCommand.initialize_options(self)
- self.pytest_args = ['--strict', '--verbose', '--tb=long', 'tests']
-
- def finalize_options(self):
- TestCommand.finalize_options(self)
-
- def run_tests(self):
- # import here, cause outside the eggs aren't loaded
- import pytest
- errno = pytest.main(self.pytest_args)
- sys.exit(errno)
+cwd = os.path.abspath(os.path.dirname(__file__))
def read(filename):
with codecs.open(os.path.join(cwd, filename), 'rb', 'utf-8') as h:
View
8 tests/test_api.py
@@ -6,11 +6,11 @@
import unittest
import twitter
-from .apikey import (CONSUMER_KEY,
- CONSUMER_SECRET,
- ACCESS_TOKEN_KEY,
- ACCESS_TOKEN_SECRET)
+CONSUMER_KEY = os.getenv('CONSUMER_KEY', None)
+CONSUMER_SECRET = os.getenv('CONSUMER_SECRET', None)
+ACCESS_TOKEN_KEY = os.getenv('ACCESS_TOKEN_KEY', None)
+ACCESS_TOKEN_SECRET = os.getenv('ACCESS_TOKEN_SECRET', None)
@unittest.skipIf(not CONSUMER_KEY and not CONSUMER_SECRET, "No tokens provided")
class ApiTest(unittest.TestCase):

0 comments on commit 91d425d

Please sign in to comment.
Something went wrong with that request. Please try again.