Skip to content

Commit 678742a

Browse files
committed
activate coveralls again
1 parent bf17b10 commit 678742a

File tree

8 files changed

+45
-43
lines changed

8 files changed

+45
-43
lines changed

.coveragerc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[run]
2+
plugins = Cython.Coverage
3+
source = jnius/
4+
omit =
5+
tests
6+
*__init__.py

.github/workflows/push.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,49 +50,39 @@ jobs:
5050
if: matrix.os == 'windows-latest'
5151
run: |
5252
"%VS140COMNTOOLS%../../VC/vcvarsall.bat"
53-
echo "$INCLUDE"
5453
set INCLUDE "C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt"
5554
pip install --timeout=120 -U setuptools cython
56-
pip install --timeout=120 -vv .[dev,ci]
55+
pip install --timeout=120 --editable .[dev,ci]
5756
5857
- name: install
5958
if: matrix.os == 'ubuntu-latest'
6059
run: |
6160
pip install --timeout=120 -U setuptools cython
62-
pip install --timeout=120 .[dev,ci]
61+
pip install --timeout=120 --editable .[dev,ci]
6362
6463
- name: install-osx
6564
if: matrix.os == 'macOs-latest'
6665
run: |
6766
brew install ant
6867
pip install --timeout=120 --user -U setuptools cython
69-
pip install --timeout=120 --user .[dev,ci]
68+
pip install --timeout=120 --user --editable .[dev,ci]
7069
7170
- name: test-windows
7271
if: matrix.os == 'windows-latest'
7372
run: |
7473
$env:PATH +=";$env:JAVA_HOME\jre\bin\server\;$env:JAVA_HOME\jre\bin\client\;$env:JAVA_HOME\bin\server\"
75-
$env:CLASSPATH ="../build/test-classes;../build/classes"
76-
74+
$env:CLASSPATH ="./build/test-classes;./build/classes"
7775
ant all
78-
cd tests
79-
pytest -v
76+
pytest
8077
8178
- name: test
82-
if: matrix.os == 'ubuntu-latest'
83-
run: |
84-
ant all
85-
cd tests
86-
CLASSPATH=../build/test-classes:../build/classes pytest -v
87-
88-
- name: test
89-
if: matrix.os == 'macOs-latest'
79+
if: matrix.os != 'windows-latest'
9080
run: |
9181
ant all
92-
cd tests
93-
CLASSPATH=../build/test-classes:../build/classes python -m pytest -v
82+
CLASSPATH=./build/test-classes:./build/classes python -m pytest
9483
95-
# - name: coveralls
96-
# run: python -m coveralls
97-
# env:
98-
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
84+
- name: coveralls
85+
run: python -m coveralls
86+
env:
87+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
88+
COVERALLS_PARALLEL: true

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
addopts = --cov=jnius -v tests

setup.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def compile_native_invocation_handler(*possible_homes):
9595
# generate the config.pxi
9696
with open(join(dirname(__file__), 'jnius', 'config.pxi'), 'w') as fd:
9797
fd.write('DEF JNIUS_PLATFORM = {0!r}\n\n'.format(PLATFORM))
98+
if getenv('GITHUB_WORKFLOW') == 'Tests':
99+
print("GITHUB_WORKFLOW Tests detected, tracing cython code for coverage")
100+
fd.write('# cython: linetrace=True')
101+
fd.write('# distutils: define_macros=CYTHON_TRACE=1')
98102
if not PY2:
99103
fd.write('# cython: language_level=3\n\n')
100104
fd.write('DEF JNIUS_PYTHON3 = True\n\n')

tests/__init__.py

Whitespace-only changes.

tests/test_int_vs_long.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
from jnius import autoclass, cast, PythonJavaClass, java_method
44

55

6-
class TestImplemIterator(PythonJavaClass):
6+
class _TestImplemIterator(PythonJavaClass):
77
__javainterfaces__ = ['java/util/ListIterator']
88

99

10-
class TestImplem(PythonJavaClass):
10+
class _TestImplem(PythonJavaClass):
1111
__javainterfaces__ = ['java/util/List']
1212

1313
def __init__(self, *args):
14-
super(TestImplem, self).__init__(*args)
14+
super(_TestImplem, self).__init__(*args)
1515
self.data = list(args)
1616

1717
@java_method('()I')
@@ -39,7 +39,7 @@ def test_reverse(self):
3939
Collections = autoclass('java.util.Collections')
4040
List = autoclass('java.util.List')
4141
pylist = list(range(10))
42-
a = TestImplem(*pylist)
42+
a = _TestImplem(*pylist)
4343
self.assertEqual(a.data, pylist)
4444
self.assertEqual(str(a.data), '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]')
4545

tests/test_proxy.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
print('1: declare a TestImplem that implement Collection')
1010

1111

12-
class TestImplemIterator(PythonJavaClass):
12+
class _TestImplemIterator(PythonJavaClass):
1313
__javainterfaces__ = [
1414
#'java/util/Iterator',
1515
'java/util/ListIterator', ]
@@ -55,16 +55,16 @@ def set(self, obj):
5555
self.collection.data[self.index - 1] = obj
5656

5757

58-
class TestImplem(PythonJavaClass):
58+
class _TestImplem(PythonJavaClass):
5959
__javainterfaces__ = ['java/util/List']
6060

6161
def __init__(self, *args):
62-
super(TestImplem, self).__init__(*args)
62+
super(_TestImplem, self).__init__(*args)
6363
self.data = list(args)
6464

6565
@java_method('()Ljava/util/Iterator;')
6666
def iterator(self):
67-
it = TestImplemIterator(self)
67+
it = _TestImplemIterator(self)
6868
return it
6969

7070
@java_method('()Ljava/lang/String;')
@@ -91,17 +91,17 @@ def toArray(self):
9191

9292
@java_method('()Ljava/util/ListIterator;')
9393
def listIterator(self):
94-
it = TestImplemIterator(self)
94+
it = _TestImplemIterator(self)
9595
return it
9696

9797
@java_method('(I)Ljava/util/ListIterator;',
9898
name='ListIterator')
9999
def listIteratorI(self, index):
100-
it = TestImplemIterator(self, index)
100+
it = _TestImplemIterator(self, index)
101101
return it
102102

103103

104-
class TestBadSignature(PythonJavaClass):
104+
class _TestBadSignature(PythonJavaClass):
105105
__javainterfaces__ = ['java/util/List']
106106

107107
@java_method('(Landroid/bluetooth/BluetoothDevice;IB[])V')
@@ -110,7 +110,7 @@ def bad_signature(self, *args):
110110

111111

112112
print('2: instantiate the class, with some data')
113-
a = TestImplem(*list(range(10)))
113+
a = _TestImplem(*list(range(10)))
114114
print(a)
115115
print(dir(a))
116116

@@ -158,7 +158,7 @@ def bad_signature(self, *args):
158158
# test bad signature
159159
threw = False
160160
try:
161-
TestBadSignature()
161+
_TestBadSignature()
162162
except Exception:
163163
threw = True
164164

tests/test_signature.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
JString = autoclass('java/lang/String')
99
JListIterator = autoclass("java.util.ListIterator")
1010

11-
class TestImplemIterator(PythonJavaClass):
11+
class _TestImplemIterator(PythonJavaClass):
1212
__javainterfaces__ = [
1313
'java/util/ListIterator', ]
1414

1515
def __init__(self, collection, index=0):
16-
super(TestImplemIterator, self).__init__()
16+
super(_TestImplemIterator, self).__init__()
1717
self.collection = collection
1818
self.index = index
1919

@@ -54,16 +54,16 @@ def set(self, obj):
5454
self.collection.data[self.index - 1] = obj
5555

5656

57-
class TestImplem(PythonJavaClass):
57+
class _TestImplem(PythonJavaClass):
5858
__javainterfaces__ = ['java/util/List']
5959

6060
def __init__(self, *args):
61-
super(TestImplem, self).__init__(*args)
61+
super(_TestImplem, self).__init__(*args)
6262
self.data = list(args)
6363

6464
@with_signature(autoclass("java.util.Iterator"), [])
6565
def iterator(self):
66-
it = TestImplemIterator(self)
66+
it = _TestImplemIterator(self)
6767
return it
6868

6969
@with_signature(JString, [])
@@ -90,14 +90,14 @@ def toArray(self):
9090

9191
@with_signature(JListIterator, [])
9292
def listIterator(self):
93-
it = TestImplemIterator(self)
93+
it = _TestImplemIterator(self)
9494
return it
9595

9696
# TODO cover this case of listIterator.
9797
@java_method(signature(JListIterator, [jint]),
9898
name='ListIterator')
9999
def listIteratorI(self, index):
100-
it = TestImplemIterator(self, index)
100+
it = _TestImplemIterator(self, index)
101101
return it
102102

103103

@@ -107,7 +107,7 @@ class SignaturesTest(unittest.TestCase):
107107

108108
def test_construct_stack_from_testimplem(self):
109109
Stack = autoclass("java.util.Stack")
110-
pyjlist = TestImplem(1, 2, 3, 4, 5, 6, 7)
110+
pyjlist = _TestImplem(1, 2, 3, 4, 5, 6, 7)
111111
stack = Stack()
112112
stack.addAll(pyjlist)
113113
self.assertEquals(7, pyjlist.size())

0 commit comments

Comments
 (0)