svn commit: r442250 - in head/devel/py-codecov: . files
Carlos J. Puga Medina
cpm at FreeBSD.org
Wed May 31 18:04:26 UTC 2017
Author: cpm
Date: Wed May 31 18:04:24 2017
New Revision: 442250
URL: https://svnweb.freebsd.org/changeset/ports/442250
Log:
devel/py-codecov: Add test support
- Switch to USE_GITHUB
- Add TEST_DEPENDS
- Allow concurrent installation (USE_PYTHON=concurrent)
- Add do-test target
- Add a comment to explain why some test cases has been removed in patch-tests_test.py
- Bump PORTREVISION
Reviewed by: koobs
Differential Revision: https://reviews.freebsd.org/D10873
Added:
head/devel/py-codecov/files/
head/devel/py-codecov/files/patch-tests_test.py (contents, props changed)
Modified:
head/devel/py-codecov/Makefile
head/devel/py-codecov/distinfo
Modified: head/devel/py-codecov/Makefile
==============================================================================
--- head/devel/py-codecov/Makefile Wed May 31 17:47:28 2017 (r442249)
+++ head/devel/py-codecov/Makefile Wed May 31 18:04:24 2017 (r442250)
@@ -3,8 +3,9 @@
PORTNAME= codecov
PORTVERSION= 2.0.9
+DISTVERSIONPREFIX= v
+PORTREVISION= 1
CATEGORIES= devel python
-MASTER_SITES= CHEESESHOP
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
MAINTAINER= cpm at FreeBSD.org
@@ -14,10 +15,19 @@ LICENSE= APACHE20
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}coverage>0:devel/py-coverage \
${PYTHON_PKGNAMEPREFIX}requests>=2.7.9:www/py-requests
+TEST_DEPENDS= ${PYTHON_PKGNAMEPREFIX}ddt>0:devel/py-ddt \
+ ${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock \
+ ${PYTHON_PKGNAMEPREFIX}pytest>0:devel/py-pytest
USES= python
-USE_PYTHON= autoplist distutils
+USE_PYTHON= autoplist concurrent distutils
+USE_GITHUB= yes
+GH_PROJECT= ${PORTNAME}-python
+
NO_ARCH= yes
+
+do-test:
+ @cd ${WRKSRC} && ${PYTHON_CMD} -m pytest -v tests/test.py
.include <bsd.port.mk>
Modified: head/devel/py-codecov/distinfo
==============================================================================
--- head/devel/py-codecov/distinfo Wed May 31 17:47:28 2017 (r442249)
+++ head/devel/py-codecov/distinfo Wed May 31 18:04:24 2017 (r442250)
@@ -1,3 +1,3 @@
-TIMESTAMP = 1493465689
-SHA256 (codecov-2.0.9.tar.gz) = db1c182ca896244d8644d8410a33f6f6dd1cc24d80209907a65077445923f00c
-SIZE (codecov-2.0.9.tar.gz) = 9563
+TIMESTAMP = 1495486257
+SHA256 (codecov-codecov-python-v2.0.9_GH0.tar.gz) = 3ea0fb29746bfe8856c43ce9be893896ad0b8097f139954c6fd17814d14fd282
+SIZE (codecov-codecov-python-v2.0.9_GH0.tar.gz) = 18122
Added: head/devel/py-codecov/files/patch-tests_test.py
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/devel/py-codecov/files/patch-tests_test.py Wed May 31 18:04:24 2017 (r442250)
@@ -0,0 +1,137 @@
+# The following test cases fails because the .git directory is not included.
+# Remove them for now until the reported issue #100 is fixed.
+# https://github.com/codecov/codecov-python/issues/100
+
+--- tests/test.py.orig 2017-04-28 14:06:12 UTC
++++ tests/test.py
+@@ -2,9 +2,9 @@ import os
+ import sys
+ import pickle
+ import itertools
++import unittest
+ from ddt import ddt, data
+ from mock import patch, Mock
+-import unittest2 as unittest
+
+ import subprocess
+
+@@ -134,21 +134,6 @@ class TestUploader(unittest.TestCase):
+ self.assertEqual(codecov.main(), None)
+ assert post.called and put.called
+
+- def test_send(self):
+- with patch('requests.post') as post:
+- with patch('requests.put') as put:
+- post.return_value = Mock(status_code=200, text='target\ns3')
+- put.return_value = Mock(status_code=200)
+- with open(self.filepath, 'w+') as f:
+- f.write('coverage data')
+- res = self.run_cli(False, commit='a'*40, branch='master', token='<token>')
+- self.assertEqual(res['result'].strip(), 'target')
+- assert 'https://codecov.io/upload/v4?' in post.call_args[0][0]
+- assert 'commit=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' in post.call_args[0][0]
+- assert 'token=%3Ctoken%3E' in post.call_args[0][0]
+- assert 'branch=master' in post.call_args[0][0]
+- assert 'tests/test.py' in put.call_args[1]['data']
+-
+ def test_send_error(self):
+ with patch('requests.post') as post:
+ post.return_value = Mock(status_code=400, text='error')
+@@ -181,18 +166,6 @@ class TestUploader(unittest.TestCase):
+ res = self.run_cli(token='@'+self.token, commit='a', branch='b')
+ self.assertIn('token=a', res['urlargs'])
+
+- def test_bowerrc(self):
+- with open(self.bowerrc, 'w+') as f:
+- f.write('{"directory": "tests"}')
+- with open(self.filepath, 'w+') as f:
+- f.write('coverage data')
+- try:
+- self.run_cli(**self.defaults)
+- except AssertionError as e:
+- self.assertEqual(str(e), "No coverage report found")
+- else:
+- raise Exception("Did not raise AssertionError")
+-
+ def test_disable_search(self):
+ self.fake_report()
+ try:
+@@ -246,33 +219,6 @@ class TestUploader(unittest.TestCase):
+ else:
+ raise Exception("Did not raise AssertionError")
+
+- def test_bowerrc_none(self):
+- with open(self.bowerrc, 'w+') as f:
+- f.write('{"other_key": "tests"}')
+- with open(self.filepath, 'w+') as f:
+- f.write('coverage data')
+- res = self.run_cli(**self.defaults)
+- self.assertIn('tests/test.py', res['reports'])
+-
+- def test_discovers(self):
+- with open(self.jacoco, 'w+') as f:
+- f.write('<jacoco></jacoco>')
+- with open(self.filepath, 'w+') as f:
+- f.write('coverage data')
+- res = self.run_cli(**self.defaults)
+- self.assertIn('coverage.xml', res['reports'])
+- self.assertIn('coverage data', res['reports'])
+- self.assertIn('jacoco.xml', res['reports'])
+- self.assertIn('<jacoco></jacoco>', res['reports'])
+-
+- def test_not_jacoco(self):
+- with open(self.filepath, 'w+') as f:
+- f.write('<data>')
+- res = self.run_cli(file='tests/coverage.xml', **self.defaults)
+- res = res['reports'].split('<<<<<< network\n')[1].splitlines()
+- self.assertEqual(res[0], '# path=tests/coverage.xml')
+- self.assertEqual(res[1], '<data>')
+-
+ def test_run_coverage(self):
+ self.skipTest('Not sure how to pull off atm')
+ with open(self.coverage, 'w+') as f:
+@@ -339,23 +285,6 @@ class TestUploader(unittest.TestCase):
+ self.assertEqual(res['query']['branch'], 'master')
+ self.assertEqual(res['codecov'].token, 'token')
+
+- def test_ci_jenkins_blue_ocean(self):
+- self.set_env(JENKINS_URL='https://....',
+- BUILD_URL='https://....',
+- BRANCH_NAME='master',
+- CHANGE_ID='1',
+- BUILD_NUMBER='41',
+- CODECOV_TOKEN='token')
+- self.fake_report()
+- res = self.run_cli()
+- self.assertEqual(res['query']['service'], 'jenkins')
+- self.assertEqual(res['query']['commit'], codecov.check_output(("git", "rev-parse", "HEAD")))
+- self.assertEqual(res['query']['build'], '41')
+- self.assertEqual(res['query']['build_url'], 'https://....')
+- self.assertEqual(res['query']['pr'], '1')
+- self.assertEqual(res['query']['branch'], 'master')
+- self.assertEqual(res['codecov'].token, 'token')
+-
+ def test_ci_travis(self):
+ self.set_env(TRAVIS="true",
+ TRAVIS_BRANCH="master",
+@@ -459,20 +388,6 @@ class TestUploader(unittest.TestCase):
+ self.assertEqual(res['query']['build'], '10')
+ self.assertEqual(res['query']['pr'], '10')
+ self.assertEqual(res['query']['job'], 'default')
+- self.assertEqual(res['codecov'].token, 'token')
+-
+- def test_ci_drone(self):
+- self.set_env(DRONE='true',
+- DRONE_BUILD_NUMBER='10',
+- DRONE_BRANCH='master',
+- DRONE_BUILD_URL='https://drone.io/github/builds/1',
+- CODECOV_TOKEN='token')
+- self.fake_report()
+- res = self.run_cli()
+- self.assertEqual(res['query']['service'], 'drone.io')
+- self.assertEqual(res['query']['commit'], codecov.check_output(("git", "rev-parse", "HEAD")))
+- self.assertEqual(res['query']['build'], '10')
+- self.assertEqual(res['query']['build_url'], 'https://drone.io/github/builds/1')
+ self.assertEqual(res['codecov'].token, 'token')
+
+ def test_ci_shippable(self):
More information about the svn-ports-all
mailing list