Browse Source

Set up Travis CI and tox

Chang-Hung Liang 4 years ago
parent
commit
42526f4497
7 changed files with 45 additions and 22 deletions
  1. 16 0
      .travis.yml
  2. 1 0
      MANIFEST.in
  3. 6 3
      README.rst
  4. 2 0
      requirements-test.txt
  5. 5 0
      requirements.txt
  6. 9 17
      setup.py
  7. 6 2
      tox.ini

+ 16 - 0
.travis.yml

@@ -0,0 +1,16 @@
+language: python
+python:
+  - "2.6"
+  - "2.7"
+  - "3.3"
+  - "3.4"
+  - "3.5"
+  - "pypy"
+  - "pypy3"
+
+install:
+  - pip install -r requirements.txt
+  - pip install -r requirements-test.txt
+
+script:
+  - py.test

+ 1 - 0
MANIFEST.in

@@ -0,0 +1 @@
+include README.rst LICENSE requirements.txt requirements-test.txt

+ 6 - 3
README.rst

@@ -1,7 +1,7 @@
-HTTP Prompt
-===========
+HTTP Prompt (A WORK IN PROGRESS)
+==============================
 
-**WORK IN PROGRESS**
+|Build Status|
 
 An interactive command-line HTTP client featuring auto-completion and syntax
 highlighting.
@@ -46,3 +46,6 @@ Use case::
         "url": "http://httpbin.org/post?sex=M"
     }
 
+
+.. |Build Status| image:: https://api.travis-ci.org/eliangcs/http-prompt.svg?branch=master
+    :target: https://travis-ci.org/eliangcs/http-prompt

+ 2 - 0
requirements-test.txt

@@ -0,0 +1,2 @@
+pytest
+pytest-cov

+ 5 - 0
requirements.txt

@@ -0,0 +1,5 @@
+click>=5.0
+httpie>=0.9.0
+parsimonious>=0.6.2
+prompt-toolkit>=0.60
+Pygments>=2.1.0

+ 9 - 17
setup.py

@@ -34,20 +34,14 @@ def read_description(filename):
         return f.read()
 
 
-requirements = [
-    # TODO
-    'click>=5.0',
-    'httpie>=0.9.0',
-    'parsimonious>=0.6.2',
-    'prompt-toolkit>=0.60',
-    'Pygments>=2.1.0',
-]
+def read_requirements(filename):
+    try:
+        with open(filename) as f:
+            return f.read().splitlines()
+    except IOError:
+        import os
+        raise IOError(os.getcwd())
 
-test_requirements = [
-    # TODO
-    'pytest',
-    'pytest-cov',
-]
 
 setup(
     name='http-prompt',
@@ -63,7 +57,7 @@ setup(
         [console_scripts]
         http-prompt=http_prompt.cli:cli
     """,
-    install_requires=requirements,
+    install_requires=read_requirements('requirements.txt'),
     classifiers=[
         'Development Status :: 2 - Pre-Alpha',
         'Intended Audience :: Developers',
@@ -77,7 +71,5 @@ setup(
         'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5'
-    ],
-    test_suites='tests',
-    test_requires=test_requirements
+    ]
 )

+ 6 - 2
tox.ini

@@ -4,9 +4,13 @@
 # and then run "tox" from this directory.
 
 [tox]
-envlist = py26, py27, py33, py34, py35, pypy
+envlist = py26, py27, py33, py34, py35, pypy, pypy3
 
 [testenv]
 commands = py.test
 deps =
-    pytest
+    -rrequirements-test.txt
+
+[pytest]
+testpaths = tests
+addopts = --cov-report term-missing --cov http_prompt