Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions github_activity/github_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,10 @@ def filter_ignored(userlist):
if data.empty:
return

# Extract datetime strings from data attributes for pandas query
since_dt_str = data["since_dt_str"] # noqa: F841
until_dt_str = data["until_dt_str"] # noqa: F841

# Separate into closed and opened
closed = data.query("closedAt >= @since_dt_str and closedAt <= @until_dt_str")
opened = data.query("createdAt >= @since_dt_str and createdAt <= @until_dt_str")
Expand Down
24 changes: 13 additions & 11 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@
[
# CLI with URL
(
"github-activity {url} -s 2019-09-01 -u 2019-11-01 -o {path_output}",
"github-activity {url} -s 2021-01-01 -u 2021-01-15 -o {path_output}",
"cli_w_url",
),
# CLI with parts
(
"github-activity {org}/{repo} -s 2019-09-01 -u 2019-11-01 -o {path_output}",
"github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output}",
"cli_w_parts",
),
# CLI with default branch
(
"github-activity {org}/{repo} -s 2019-09-01 -u 2019-11-01 -o {path_output} -b master",
"github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output} -b master",
"cli_def_branch",
),
# CLI with no target
(
"github-activity -s 2019-09-01 -u 2019-11-01 -o {path_output}",
"github-activity -s 2021-01-01 -u 2021-01-15 -o {path_output}",
"cli_no_target",
),
],
Expand All @@ -46,7 +46,7 @@ def test_cli(tmpdir, file_regression, cmd, basename):

def test_cli_dot_config(tmp_path, monkeypatch, file_regression):
"""Test that pyproject.toml config is loaded"""
cmd = "github-activity -s 2019-09-01 -u 2019-11-01 -o {path_output}"
cmd = "github-activity -s 2021-01-01 -u 2021-01-15 -o {path_output}"
basename = "cli_no_target_pyproject"

path_output = tmp_path / "out.md"
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_cli_nonexistent_branch(tmpdir):

org, repo = ("executablebooks", "github-activity")

cmd = f"github-activity {org}/{repo} -s 2019-09-01 -u 2019-11-01 -o {path_output} -b foo"
cmd = f"github-activity {org}/{repo} -s 2021-01-01 -u 2021-01-15 -o {path_output} -b foo"
run(cmd.split(), check=True)
md = path_output.read_text()
assert "Contributors to this release" in md
Expand All @@ -100,7 +100,8 @@ def test_pr_split(tmpdir, file_regression):
url = "https://github.com/jupyter-book/jupyter-book"

# This release range covers some PRs with tags, and some with prefixes
cmd = f"github-activity {url} -s v0.7.1 -u v0.7.3 -o {path_output}"
# Using smaller range v0.7.2 to v0.7.3 to reduce API calls
cmd = f"github-activity {url} -s v0.7.2 -u v0.7.3 -o {path_output}"
run(cmd.split(), check=True)
md = path_output.read_text()
md = md.split("## Contributors to this release")[0]
Expand All @@ -111,18 +112,19 @@ def test_cli_all(tmpdir, file_regression):
"""Test that a full changelog is created"""
path_tmp = Path(tmpdir)
path_output = path_tmp.joinpath("out.md")
cmd = f"github-activity executablebooks/github-activity --all -o {path_output}"
# Limit to recent releases instead of --all to reduce API calls
cmd = f"github-activity executablebooks/github-activity -s v0.2.0 -u v0.3.0 -o {path_output}"
run(cmd.split(), check=True)
md = path_output.read_text()
index = md.index("## v0.2.0")
file_regression.check(md[index:], extension=".md")
file_regression.check(md, extension=".md")


def test_cli_ignore_user(tmpdir):
"""Test that a full changelog is created"""
path_tmp = Path(tmpdir)
path_output = path_tmp.joinpath("out.md")
cmd = f"github-activity executablebooks/github-activity --ignore-contributor choldgraf -s v1.0.2 -o {path_output}"
# Add end date to limit query range
cmd = f"github-activity executablebooks/github-activity --ignore-contributor choldgraf -s v1.0.2 -u v1.0.3 -o {path_output}"
run(cmd.split(), check=True)
md = path_output.read_text()
assert "@choldgraf" not in md
Expand Down
29 changes: 5 additions & 24 deletions tests/test_cli/cli_def_branch.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
# master@{2019-09-01}...master@{2019-11-01}
# master@{2021-01-01}...master@{2021-01-15}

([full changelog](https://github.com/executablebooks/github-activity/compare/479cc4b2f5504945021e3c4ee84818a10fabf810...ed7f1ed78b523c6b9fe6b3ac29e834087e299296))

## New features added

- adding contributors list [#10](https://github.com/executablebooks/github-activity/pull/10) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
- Support git references etc. [#6](https://github.com/executablebooks/github-activity/pull/6) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

## Enhancements made

- defining contributions [#14](https://github.com/executablebooks/github-activity/pull/14) ([@choldgraf](https://github.com/choldgraf), [@betatim](https://github.com/betatim))
- updating CLI for new tags [#12](https://github.com/executablebooks/github-activity/pull/12) ([@choldgraf](https://github.com/choldgraf))
- some improvements to `since` and opened issues list [#8](https://github.com/executablebooks/github-activity/pull/8) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88))

## Bugs fixed

- fixing link to changelog with refs [#11](https://github.com/executablebooks/github-activity/pull/11) ([@choldgraf](https://github.com/choldgraf))

## Maintenance and upkeep improvements

- adding authentication information [#2](https://github.com/executablebooks/github-activity/pull/2) ([@choldgraf](https://github.com/choldgraf))

## Documentation improvements

- Mention the required GITHUB_ACCESS_TOKEN [#1](https://github.com/executablebooks/github-activity/pull/1) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))
- 🐛 FIX: tags like 'doctor' would trigger 'doc' tag [#40](https://github.com/executablebooks/github-activity/pull/40) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

## Contributors to this release

The following people contributed discussions, new ideas, code and documentation contributions, and review.
See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports).

([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2019-09-01&to=2019-11-01&type=c))
([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2021-01-01&to=2021-01-15&type=c))

@betatim ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues)) | @choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues))
@choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2021-01-01..2021-01-15&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2021-01-01..2021-01-15&type=Issues))
29 changes: 5 additions & 24 deletions tests/test_cli/cli_no_target.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
# master@{2019-09-01}...master@{2019-11-01}
# master@{2021-01-01}...master@{2021-01-15}

([full changelog](https://github.com/executablebooks/github-activity/compare/479cc4b2f5504945021e3c4ee84818a10fabf810...ed7f1ed78b523c6b9fe6b3ac29e834087e299296))

## New features added

- adding contributors list [#10](https://github.com/executablebooks/github-activity/pull/10) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
- Support git references etc. [#6](https://github.com/executablebooks/github-activity/pull/6) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

## Enhancements made

- defining contributions [#14](https://github.com/executablebooks/github-activity/pull/14) ([@choldgraf](https://github.com/choldgraf), [@betatim](https://github.com/betatim))
- updating CLI for new tags [#12](https://github.com/executablebooks/github-activity/pull/12) ([@choldgraf](https://github.com/choldgraf))
- some improvements to `since` and opened issues list [#8](https://github.com/executablebooks/github-activity/pull/8) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88))

## Bugs fixed

- fixing link to changelog with refs [#11](https://github.com/executablebooks/github-activity/pull/11) ([@choldgraf](https://github.com/choldgraf))

## Maintenance and upkeep improvements

- adding authentication information [#2](https://github.com/executablebooks/github-activity/pull/2) ([@choldgraf](https://github.com/choldgraf))

## Documentation improvements

- Mention the required GITHUB_ACCESS_TOKEN [#1](https://github.com/executablebooks/github-activity/pull/1) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))
- 🐛 FIX: tags like 'doctor' would trigger 'doc' tag [#40](https://github.com/executablebooks/github-activity/pull/40) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

## Contributors to this release

The following people contributed discussions, new ideas, code and documentation contributions, and review.
See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports).

([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2019-09-01&to=2019-11-01&type=c))
([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2021-01-01&to=2021-01-15&type=c))

@betatim ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues)) | @choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues))
@choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2021-01-01..2021-01-15&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2021-01-01..2021-01-15&type=Issues))
29 changes: 5 additions & 24 deletions tests/test_cli/cli_no_target_pyproject.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
##### master@{2019-09-01}...master@{2019-11-01}
##### master@{2021-01-01}...master@{2021-01-15}

([full changelog](https://github.com/executablebooks/github-activity/compare/479cc4b2f5504945021e3c4ee84818a10fabf810...ed7f1ed78b523c6b9fe6b3ac29e834087e299296))

###### New features added

- adding contributors list [#10](https://github.com/executablebooks/github-activity/pull/10) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
- Support git references etc. [#6](https://github.com/executablebooks/github-activity/pull/6) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

###### Enhancements made

- defining contributions [#14](https://github.com/executablebooks/github-activity/pull/14) ([@choldgraf](https://github.com/choldgraf), [@betatim](https://github.com/betatim))
- updating CLI for new tags [#12](https://github.com/executablebooks/github-activity/pull/12) ([@choldgraf](https://github.com/choldgraf))
- some improvements to `since` and opened issues list [#8](https://github.com/executablebooks/github-activity/pull/8) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88))

###### Bugs fixed

- fixing link to changelog with refs [#11](https://github.com/executablebooks/github-activity/pull/11) ([@choldgraf](https://github.com/choldgraf))

###### Maintenance and upkeep improvements

- adding authentication information [#2](https://github.com/executablebooks/github-activity/pull/2) ([@choldgraf](https://github.com/choldgraf))

###### Documentation improvements

- Mention the required GITHUB_ACCESS_TOKEN [#1](https://github.com/executablebooks/github-activity/pull/1) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))
- 🐛 FIX: tags like 'doctor' would trigger 'doc' tag [#40](https://github.com/executablebooks/github-activity/pull/40) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

###### Contributors to this release

The following people contributed discussions, new ideas, code and documentation contributions, and review.
See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports).

([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2019-09-01&to=2019-11-01&type=c))
([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2021-01-01&to=2021-01-15&type=c))

@betatim ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues)) | @choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues))
@choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2021-01-01..2021-01-15&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2021-01-01..2021-01-15&type=Issues))
29 changes: 5 additions & 24 deletions tests/test_cli/cli_w_parts.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,16 @@
# master@{2019-09-01}...master@{2019-11-01}
# master@{2021-01-01}...master@{2021-01-15}

([full changelog](https://github.com/executablebooks/github-activity/compare/479cc4b2f5504945021e3c4ee84818a10fabf810...ed7f1ed78b523c6b9fe6b3ac29e834087e299296))

## New features added

- adding contributors list [#10](https://github.com/executablebooks/github-activity/pull/10) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
- Support git references etc. [#6](https://github.com/executablebooks/github-activity/pull/6) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

## Enhancements made

- defining contributions [#14](https://github.com/executablebooks/github-activity/pull/14) ([@choldgraf](https://github.com/choldgraf), [@betatim](https://github.com/betatim))
- updating CLI for new tags [#12](https://github.com/executablebooks/github-activity/pull/12) ([@choldgraf](https://github.com/choldgraf))
- some improvements to `since` and opened issues list [#8](https://github.com/executablebooks/github-activity/pull/8) ([@choldgraf](https://github.com/choldgraf), [@consideRatio](https://github.com/consideRatio))
([full changelog](https://github.com/executablebooks/github-activity/compare/c740a454def057304556675ce7694dc0f2eb6c88...c740a454def057304556675ce7694dc0f2eb6c88))

## Bugs fixed

- fixing link to changelog with refs [#11](https://github.com/executablebooks/github-activity/pull/11) ([@choldgraf](https://github.com/choldgraf))

## Maintenance and upkeep improvements

- adding authentication information [#2](https://github.com/executablebooks/github-activity/pull/2) ([@choldgraf](https://github.com/choldgraf))

## Documentation improvements

- Mention the required GITHUB_ACCESS_TOKEN [#1](https://github.com/executablebooks/github-activity/pull/1) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))
- 🐛 FIX: tags like 'doctor' would trigger 'doc' tag [#40](https://github.com/executablebooks/github-activity/pull/40) ([@consideRatio](https://github.com/consideRatio), [@choldgraf](https://github.com/choldgraf))

## Contributors to this release

The following people contributed discussions, new ideas, code and documentation contributions, and review.
See [our definition of contributors](https://github-activity.readthedocs.io/en/latest/#how-does-this-tool-define-contributions-in-the-reports).

([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2019-09-01&to=2019-11-01&type=c))
([GitHub contributors page for this release](https://github.com/executablebooks/github-activity/graphs/contributors?from=2021-01-01&to=2021-01-15&type=c))

@betatim ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Abetatim+updated%3A2019-09-01..2019-11-01&type=Issues)) | @choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2019-09-01..2019-11-01&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2019-09-01..2019-11-01&type=Issues))
@choldgraf ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3Acholdgraf+updated%3A2021-01-01..2021-01-15&type=Issues)) | @consideRatio ([activity](https://github.com/search?q=repo%3Aexecutablebooks%2Fgithub-activity+involves%3AconsideRatio+updated%3A2021-01-01..2021-01-15&type=Issues))
Loading
Loading