Skip to content

Commit 7c3c379

Browse files
authored
Merge pull request #243 from Dakevid/master
pytrap: fix workflow and build system
2 parents 4c0c6b7 + d8a43ba commit 7c3c379

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

.github/workflows/c-cpp.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ jobs:
2626
- name: install
2727
run: sudo make install
2828
- name: install pytrap
29-
run: (cd pytrap && make coverage; sudo python3 setup.py install;)
29+
run: (cd pytrap && make test; sudo pip install . ;)
30+
- name: tests pycommon
31+
run: (cd pycommon && pip install .[test] && python3 -m pytest;)
3032
- name: make check
3133
run: make check
3234
- name: make distcheck

pytrap/Makefile.am

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@ TESTS = test.sh
2727

2828
.PHONY: coverage
2929
coverage:
30-
CFLAGS=-coverage python3 -m pip install .[test] --no-deps --disable-pip-version-check --no-cache-dir
31-
CFLAGS=-coverage python3 -m pytest --cov=pycommon || echo "Skipped python3 tests"
30+
CFLAGS=-coverage python3 -m pip install .[test] --disable-pip-version-check --no-cache-dir
31+
CFLAGS=-coverage python3 -m pytest --cov=pytrap || echo "Skipped python3 tests"
3232
@lcov --capture --directory . --output-file coverage.info 2>/dev/null && \
3333
genhtml coverage.info --output-directory out 2>/dev/null || echo "Skipped coverage analysis"
3434

35+
.PHONY: test
36+
test:
37+
python3 -m pip install .[test] --no-cache-dir
38+
python3 -m pytest
39+
3540
.PHONY: doc
3641
doc:
3742
python3 -m pip install .[docs] --no-cache-dir

pytrap/pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ license = { text = "BSD" }
1717
requires-python = ">=3.8"
1818
classifiers = [
1919
"Development Status :: 4 - Beta",
20+
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
2021
"Operating System :: POSIX :: Linux",
2122
"Programming Language :: C",
2223
"Programming Language :: Python :: 3",
@@ -63,7 +64,8 @@ sources = [
6364
"src/iplist.c",
6465
"src/fields.c"
6566
]
66-
libraries = ["trap", "unirec"]
67+
libraries = ["trap", "unirec","gcov"]
68+
extra-compile-args = ["-O2"]
6769

6870

6971
[tool.pytest.ini_options]

pytrap/src/unirecmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <getopt.h>
1111
#include <stdio.h>
1212
#include <stdlib.h>
13+
#include <sys/time.h>
1314

1415
#include "fields.h"
1516
#include "unirectemplate.h"

pytrap/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fi
4646

4747
python3 -c 'import pytrap' 2>/dev/null || exit 77
4848

49-
python3 $srcdir/setup.py test || exit $?
49+
python3 -m pytest $srcdir/test || exit $?
5050

5151
path_to_logger="$srcdir"/../../modules/logger/logger
5252

0 commit comments

Comments
 (0)