Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into clarify-escape-char…
Browse files Browse the repository at this point in the history
…acters
  • Loading branch information
jordan-gillard committed Jul 9, 2024
2 parents 549273e + 20c5d58 commit ec66721
Show file tree
Hide file tree
Showing 7 changed files with 232 additions and 11 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/tox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: tox

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
pytest:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
fail-fast: false

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Run Tests
run: tox run -m ${{ matrix.python-version }}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,11 @@ poetry install

# Run the tool
poetry run edgar-tool --help

# Run unit tests using your Poetry environment's Python interpreter
poetry run pytest

# Run unit tests with tox
poetry run tox -- run-parallel
```
</details>
2 changes: 2 additions & 0 deletions edgar_tool/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import re
from datetime import date
from typing import Any, Iterator, Dict, List, Union, Optional
Expand Down
149 changes: 140 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "edgar-tool"
version = "1.3.2"
version = "1.3.3"
description = "Search and retrieve corporate and financial data from the United States Securities and Exchange Commission (SEC)."
authors = ["Bellingcat"]
license = "GNU General Public License v3 (GPLv3)"
Expand All @@ -12,6 +12,10 @@ classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business :: Financial",
]
keywords=["scraper", "edgar", "finance", "sec"]
Expand All @@ -32,7 +36,7 @@ xmltodict = "^0.13"

[tool.poetry.group.dev.dependencies]
black = "^24.2.0"

tox = "^4.16.0"

[build-system]
requires = ["poetry-core"]
Expand Down
29 changes: 29 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import subprocess


def test_cli_should_return_help_string_when_passed_no_args():
"""Tests that running edgar-tool without any arguments returns the CLI's help string and 0 exit code."""
# GIVEN
expected = """
NAME
edgar-tool
SYNOPSIS
edgar-tool COMMAND
COMMANDS
COMMAND is one of the following:
rss
Fetch the latest RSS feed data for the given company tickers and save it to either a CSV, JSON, or JSONLines file.
text_search
Perform a custom text search on the SEC EDGAR website and save the results to either a CSV, JSON, or JSONLines file.
"""

# WHEN
result = subprocess.run(["edgar-tool"], capture_output=True, text=True)

# THEN
assert result.returncode == 0
assert result.stdout.strip() == expected.strip()
14 changes: 14 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[tox]
envlist = py39, py310, py311, py312
labels =
; Used to map GitHub workflow python version to tox env
3.9 = py39
3.10 = py310
3.11 = py311
3.12 = py312

[testenv]
deps =
pytest>=8
commands =
pytest tests/ --import-mode=importlib

0 comments on commit ec66721

Please sign in to comment.