diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e7cd87f..b722b49 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,18 +8,18 @@ jobs: test: runs-on: ubuntu-latest steps: - - name: Install ghostscript libmagickwand-dev - run: sudo apt-get install libxml2-utils + - name: Prepare for installations + run: sudo apt update -y + - name: Install Python + run: sudo apt install -y python3-pip python3-dev python3-venv + - name: Install ghostscript & imagemagick + run: sudo apt install -y ghostscript libmagickwand-dev - name: Remove policy.xml run: sudo rm /etc/ImageMagick-6/policy.xml - name: Check out repo uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - uses: actions/cache@v2 - name: Configure pip caching + - name: Configure pip caching + uses: actions/cache@v2 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt')}}-${{ hashFiles('**/requirements-dev.txt') }} @@ -31,5 +31,5 @@ jobs: run: make check-flake - name: Run tests run: make tests - - name: Examine code coverage + - name: Upload code coverage uses: codecov/codecov-action@v1.0.12 diff --git a/Makefile b/Makefile index b93b906..f740e6b 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ PYTHON := venv/bin/python PIP = venv/bin/pip venv: - python -m venv venv + python3 -m venv venv ${PIP} install --upgrade pip ${PIP} install -r requirements.txt ${PIP} install -r requirements-dev.txt diff --git a/pdfplumber/cli.py b/pdfplumber/cli.py index 3b72193..1cf882c 100644 --- a/pdfplumber/cli.py +++ b/pdfplumber/cli.py @@ -48,3 +48,7 @@ def main(args_raw=sys.argv[1:]): kwargs = {"csv": {}, "json": {"indent": args.indent}}[args.format] with PDF.open(args.infile, pages=args.pages) as pdf: converter(pdf, sys.stdout, args.types, **kwargs) + + +if __name__ == "__main__": + main() diff --git a/tests/test_convert.py b/tests/test_convert.py index 0ebc8d8..8f5c481 100644 --- a/tests/test_convert.py +++ b/tests/test_convert.py @@ -58,7 +58,9 @@ class Test(unittest.TestCase): def test_cli(self): res = run([ - "pdfplumber", + sys.executable, + "-m", + "pdfplumber.cli", self.path, "--format", "json",