runem 0.0.30__tar.gz → 0.0.31__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. {runem-0.0.30 → runem-0.0.31}/HISTORY.md +13 -0
  2. {runem-0.0.30 → runem-0.0.31}/PKG-INFO +1 -1
  3. runem-0.0.31/runem/VERSION +1 -0
  4. {runem-0.0.30 → runem-0.0.31}/runem/command_line.py +4 -4
  5. {runem-0.0.30 → runem-0.0.31}/runem/files.py +35 -17
  6. {runem-0.0.30 → runem-0.0.31}/runem.egg-info/PKG-INFO +1 -1
  7. {runem-0.0.30 → runem-0.0.31}/tests/data/help_output.3.10.txt +5 -5
  8. {runem-0.0.30 → runem-0.0.31}/tests/data/help_output.3.11.txt +5 -5
  9. {runem-0.0.30 → runem-0.0.31}/tests/test_files.py +26 -15
  10. {runem-0.0.30 → runem-0.0.31}/tests/test_runem.py +1 -1
  11. runem-0.0.30/runem/VERSION +0 -1
  12. {runem-0.0.30 → runem-0.0.31}/Containerfile +0 -0
  13. {runem-0.0.30 → runem-0.0.31}/LICENSE +0 -0
  14. {runem-0.0.30 → runem-0.0.31}/MANIFEST.in +0 -0
  15. {runem-0.0.30 → runem-0.0.31}/README.md +0 -0
  16. {runem-0.0.30 → runem-0.0.31}/runem/__init__.py +0 -0
  17. {runem-0.0.30 → runem-0.0.31}/runem/__main__.py +0 -0
  18. {runem-0.0.30 → runem-0.0.31}/runem/base.py +0 -0
  19. {runem-0.0.30 → runem-0.0.31}/runem/blocking_print.py +0 -0
  20. {runem-0.0.30 → runem-0.0.31}/runem/cli/initialise_options.py +0 -0
  21. {runem-0.0.30 → runem-0.0.31}/runem/cli.py +0 -0
  22. {runem-0.0.30 → runem-0.0.31}/runem/config.py +0 -0
  23. {runem-0.0.30 → runem-0.0.31}/runem/config_metadata.py +0 -0
  24. {runem-0.0.30 → runem-0.0.31}/runem/config_parse.py +0 -0
  25. {runem-0.0.30 → runem-0.0.31}/runem/hook_manager.py +0 -0
  26. {runem-0.0.30 → runem-0.0.31}/runem/informative_dict.py +0 -0
  27. {runem-0.0.30 → runem-0.0.31}/runem/job.py +0 -0
  28. {runem-0.0.30 → runem-0.0.31}/runem/job_execute.py +0 -0
  29. {runem-0.0.30 → runem-0.0.31}/runem/job_filter.py +0 -0
  30. {runem-0.0.30 → runem-0.0.31}/runem/job_runner_simple_command.py +0 -0
  31. {runem-0.0.30 → runem-0.0.31}/runem/job_wrapper.py +0 -0
  32. {runem-0.0.30 → runem-0.0.31}/runem/job_wrapper_python.py +0 -0
  33. {runem-0.0.30 → runem-0.0.31}/runem/log.py +0 -0
  34. {runem-0.0.30 → runem-0.0.31}/runem/py.typed +0 -0
  35. {runem-0.0.30 → runem-0.0.31}/runem/report.py +0 -0
  36. {runem-0.0.30 → runem-0.0.31}/runem/run_command.py +0 -0
  37. {runem-0.0.30 → runem-0.0.31}/runem/runem.py +0 -0
  38. {runem-0.0.30 → runem-0.0.31}/runem/runem_version.py +0 -0
  39. {runem-0.0.30 → runem-0.0.31}/runem/types.py +0 -0
  40. {runem-0.0.30 → runem-0.0.31}/runem/utils.py +0 -0
  41. {runem-0.0.30 → runem-0.0.31}/runem.egg-info/SOURCES.txt +0 -0
  42. {runem-0.0.30 → runem-0.0.31}/runem.egg-info/dependency_links.txt +0 -0
  43. {runem-0.0.30 → runem-0.0.31}/runem.egg-info/entry_points.txt +0 -0
  44. {runem-0.0.30 → runem-0.0.31}/runem.egg-info/requires.txt +0 -0
  45. {runem-0.0.30 → runem-0.0.31}/runem.egg-info/top_level.txt +0 -0
  46. {runem-0.0.30 → runem-0.0.31}/setup.cfg +0 -0
  47. {runem-0.0.30 → runem-0.0.31}/setup.py +0 -0
  48. {runem-0.0.30 → runem-0.0.31}/tests/__init__.py +0 -0
  49. {runem-0.0.30 → runem-0.0.31}/tests/cli/test_initialise_options.py +0 -0
  50. {runem-0.0.30 → runem-0.0.31}/tests/conftest.py +0 -0
  51. {runem-0.0.30 → runem-0.0.31}/tests/intentional_test_error.py +0 -0
  52. {runem-0.0.30 → runem-0.0.31}/tests/sanitise_reports_footer.py +0 -0
  53. {runem-0.0.30 → runem-0.0.31}/tests/test_base.py +0 -0
  54. {runem-0.0.30 → runem-0.0.31}/tests/test_blocking_print.py +0 -0
  55. {runem-0.0.30 → runem-0.0.31}/tests/test_cli.py +0 -0
  56. {runem-0.0.30 → runem-0.0.31}/tests/test_config.py +0 -0
  57. {runem-0.0.30 → runem-0.0.31}/tests/test_config_parse.py +0 -0
  58. {runem-0.0.30 → runem-0.0.31}/tests/test_hook_manager.py +0 -0
  59. {runem-0.0.30 → runem-0.0.31}/tests/test_informative_dict.py +0 -0
  60. {runem-0.0.30 → runem-0.0.31}/tests/test_job.py +0 -0
  61. {runem-0.0.30 → runem-0.0.31}/tests/test_job_execute.py +0 -0
  62. {runem-0.0.30 → runem-0.0.31}/tests/test_job_filter.py +0 -0
  63. {runem-0.0.30 → runem-0.0.31}/tests/test_job_runner_simple_command.py +0 -0
  64. {runem-0.0.30 → runem-0.0.31}/tests/test_job_wrapper.py +0 -0
  65. {runem-0.0.30 → runem-0.0.31}/tests/test_job_wrapper_python.py +0 -0
  66. {runem-0.0.30 → runem-0.0.31}/tests/test_report.py +0 -0
  67. {runem-0.0.30 → runem-0.0.31}/tests/test_run_command.py +0 -0
@@ -4,6 +4,19 @@ Changelog
4
4
 
5
5
  (unreleased)
6
6
  ------------
7
+ - Merge pull request #48 from
8
+ lursight/feat/merge_head_and_modified_files_in_git. [Frank Harrison]
9
+
10
+ feat(git-files): allows head, staged and unstaged git files
11
+ - Feat(git-files): allows head, staged and unstaged git files. [Frank
12
+ Harrison]
13
+
14
+ This means we can run fast tests against all files that have recently changed and get better results.
15
+
16
+
17
+ 0.0.30 (2024-04-13)
18
+ -------------------
19
+ - Release: version 0.0.30 🚀 [Frank Harrison]
7
20
  - Merge pull request #47 from lursight/feat/git-fast-files. [Frank
8
21
  Harrison]
9
22
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.30
3
+ Version: 0.0.31
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -0,0 +1 @@
1
+ 0.0.31
@@ -119,8 +119,8 @@ def parse_args(
119
119
 
120
120
  parser.add_argument(
121
121
  "-f",
122
- "--modified-files-only",
123
- dest="check_modified_files_only",
122
+ "--modified-files",
123
+ dest="check_modified_files",
124
124
  help="only use files that have changed",
125
125
  action=argparse.BooleanOptionalAction,
126
126
  default=False,
@@ -129,8 +129,8 @@ def parse_args(
129
129
 
130
130
  parser.add_argument(
131
131
  "-h",
132
- "--git-head-files-only",
133
- dest="check_head_files_only",
132
+ "--git-head-files",
133
+ dest="check_head_files",
134
134
  help="fast run of files",
135
135
  action=argparse.BooleanOptionalAction,
136
136
  default=False,
@@ -26,26 +26,44 @@ def find_files(config_metadata: ConfigMetadata) -> FilePathListLookup:
26
26
 
27
27
  file_paths: typing.List[str] = []
28
28
 
29
- if config_metadata.args.check_modified_files_only:
30
- file_paths = (
31
- subprocess_check_output(
32
- "git diff --name-only",
33
- shell=True,
29
+ if (
30
+ config_metadata.args.check_modified_files
31
+ or config_metadata.args.check_head_files
32
+ ):
33
+ if config_metadata.args.check_modified_files:
34
+ # get modified, un-staged files first
35
+ file_paths.extend(
36
+ subprocess_check_output(
37
+ "git diff --name-only",
38
+ shell=True,
39
+ )
40
+ .decode("utf-8")
41
+ .splitlines()
34
42
  )
35
- .decode("utf-8")
36
- .splitlines()
37
- )
38
- elif config_metadata.args.check_head_files_only:
39
- # Fetching modified and added files from the HEAD commit that are still on disk
40
- file_paths = (
41
- subprocess_check_output(
42
- "git diff-tree --no-commit-id --name-only -r HEAD",
43
- shell=True,
43
+ # now get modified, staged files first
44
+ file_paths.extend(
45
+ subprocess_check_output(
46
+ "git diff --name-only --staged",
47
+ shell=True,
48
+ )
49
+ .decode("utf-8")
50
+ .splitlines()
44
51
  )
45
- .decode("utf-8")
46
- .splitlines()
52
+
53
+ if config_metadata.args.check_head_files:
54
+ # Fetching modified and added files from the HEAD commit
55
+ file_paths.extend(
56
+ subprocess_check_output(
57
+ "git diff-tree --no-commit-id --name-only -r HEAD",
58
+ shell=True,
59
+ )
60
+ .decode("utf-8")
61
+ .splitlines()
62
+ )
63
+ # ensure files are unique, and still on disk i.e. filter-out deleted files
64
+ file_paths = list(
65
+ {file_path for file_path in file_paths if Path(file_path).exists()}
47
66
  )
48
- file_paths = [file_path for file_path in file_paths if Path(file_path).exists()]
49
67
  else:
50
68
  # fall-back to all files
51
69
  file_paths = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: runem
3
- Version: 0.0.30
3
+ Version: 0.0.31
4
4
  Summary: Awesome runem created by lursight
5
5
  Home-page: https://github.com/lursight/runem/
6
6
  Author: lursight
@@ -8,9 +8,9 @@ usage: -c [-H] [--jobs JOBS [JOBS ...]]
8
8
  [--dummy-option-1---complete-option]
9
9
  [--no-dummy-option-1---complete-option] [--dummy-option-2---minimal]
10
10
  [--no-dummy-option-2---minimal] [--call-graphs | --no-call-graphs]
11
- [-f | --modified-files-only | --no-modified-files-only]
12
- [-h | --git-head-files-only | --no-git-head-files-only]
13
- [--procs PROCS] [--root ROOT_DIR] [--spinner | --no-spinner]
11
+ [-f | --modified-files | --no-modified-files]
12
+ [-h | --git-head-files | --no-git-head-files] [--procs PROCS]
13
+ [--root ROOT_DIR] [--spinner | --no-spinner]
14
14
  [--verbose | --no-verbose] [--version | --no-version | -v]
15
15
 
16
16
  Runs the Lursight Lang test-suite
@@ -18,9 +18,9 @@ Runs the Lursight Lang test-suite
18
18
  [TEST_REPLACED_OPTION_HEADER]
19
19
  -H, --help show this help message and exit
20
20
  --call-graphs, --no-call-graphs
21
- -f, --modified-files-only, --no-modified-files-only
21
+ -f, --modified-files, --no-modified-files
22
22
  only use files that have changed (default: False)
23
- -h, --git-head-files-only, --no-git-head-files-only
23
+ -h, --git-head-files, --no-git-head-files
24
24
  fast run of files (default: False)
25
25
  --procs PROCS, -j PROCS
26
26
  the number of concurrent test jobs to run, -1 runs all
@@ -8,9 +8,9 @@ usage: -c [-H] [--jobs JOBS [JOBS ...]]
8
8
  [--dummy-option-1---complete-option]
9
9
  [--no-dummy-option-1---complete-option] [--dummy-option-2---minimal]
10
10
  [--no-dummy-option-2---minimal] [--call-graphs | --no-call-graphs]
11
- [-f | --modified-files-only | --no-modified-files-only]
12
- [-h | --git-head-files-only | --no-git-head-files-only]
13
- [--procs PROCS] [--root ROOT_DIR] [--spinner | --no-spinner]
11
+ [-f | --modified-files | --no-modified-files]
12
+ [-h | --git-head-files | --no-git-head-files] [--procs PROCS]
13
+ [--root ROOT_DIR] [--spinner | --no-spinner]
14
14
  [--verbose | --no-verbose] [--version | --no-version | -v]
15
15
 
16
16
  Runs the Lursight Lang test-suite
@@ -18,9 +18,9 @@ Runs the Lursight Lang test-suite
18
18
  [TEST_REPLACED_OPTION_HEADER]
19
19
  -H, --help show this help message and exit
20
20
  --call-graphs, --no-call-graphs
21
- -f, --modified-files-only, --no-modified-files-only
21
+ -f, --modified-files, --no-modified-files
22
22
  only use files that have changed
23
- -h, --git-head-files-only, --no-git-head-files-only
23
+ -h, --git-head-files, --no-git-head-files
24
24
  fast run of files
25
25
  --procs PROCS, -j PROCS
26
26
  the number of concurrent test jobs to run, -1 runs all
@@ -12,9 +12,7 @@ from runem.informative_dict import InformativeDict
12
12
  from runem.types import FilePathListLookup
13
13
 
14
14
 
15
- def _prep_config(
16
- check_modified_files_only: bool, check_head_files_only: bool
17
- ) -> ConfigMetadata:
15
+ def _prep_config(check_modified_files: bool, check_head_files: bool) -> ConfigMetadata:
18
16
  config_metadata: ConfigMetadata = ConfigMetadata(
19
17
  cfg_filepath=pathlib.Path(__file__),
20
18
  phases=("dummy phase 1",),
@@ -33,8 +31,8 @@ def _prep_config(
33
31
  )
34
32
  config_metadata.set_cli_data(
35
33
  args=Namespace(
36
- check_modified_files_only=check_modified_files_only,
37
- check_head_files_only=check_head_files_only,
34
+ check_modified_files=check_modified_files,
35
+ check_head_files=check_head_files,
38
36
  ),
39
37
  jobs_to_run=set(), # JobNames,
40
38
  phases_to_run=set(), # JobPhases,
@@ -47,14 +45,14 @@ def _prep_config(
47
45
 
48
46
 
49
47
  @pytest.mark.parametrize(
50
- "check_head_files_only",
48
+ "check_head_files",
51
49
  [
52
50
  True,
53
51
  False,
54
52
  ],
55
53
  )
56
54
  @pytest.mark.parametrize(
57
- "check_modified_files_only",
55
+ "check_modified_files",
58
56
  [
59
57
  True,
60
58
  False,
@@ -65,8 +63,8 @@ def _prep_config(
65
63
  )
66
64
  def test_find_files_basic(
67
65
  mock_subprocess_check_output: Mock,
68
- check_modified_files_only: bool,
69
- check_head_files_only: bool,
66
+ check_modified_files: bool,
67
+ check_head_files: bool,
70
68
  tmp_path: pathlib.Path,
71
69
  ) -> None:
72
70
  file_strings: List[str] = []
@@ -77,11 +75,24 @@ def test_find_files_basic(
77
75
  mock_subprocess_check_output.return_value = str.encode("\n".join(file_strings))
78
76
 
79
77
  config_metadata = _prep_config(
80
- check_modified_files_only=check_modified_files_only,
81
- check_head_files_only=check_head_files_only,
78
+ check_modified_files=check_modified_files,
79
+ check_head_files=check_head_files,
82
80
  )
83
81
  results: FilePathListLookup = find_files(config_metadata)
84
- mock_subprocess_check_output.assert_called_once()
85
- assert results == {
86
- "dummy tag": [file_strings[0]] # we filter in only the *1* files.
87
- }
82
+ if check_modified_files and check_head_files:
83
+ assert (
84
+ mock_subprocess_check_output.call_count == 3
85
+ ), "twice for modified, once for head"
86
+ assert results == {
87
+ "dummy tag": [file_strings[0]] # we filter in only the *1* files.
88
+ }
89
+ elif check_modified_files:
90
+ assert mock_subprocess_check_output.call_count == 2, "twice for modified"
91
+ assert results == {
92
+ "dummy tag": [file_strings[0]] # we filter in only the *1* files.
93
+ }
94
+ else:
95
+ assert mock_subprocess_check_output.call_count == 1, "once for git ls-files"
96
+ assert results == {
97
+ "dummy tag": [file_strings[0]] # we filter in only the *1* files.
98
+ }
@@ -688,7 +688,7 @@ def test_runem_help() -> None:
688
688
  help_dump: pathlib.Path = (
689
689
  pathlib.Path(__file__).parent / "data" / f"help_output.{version_str}.txt"
690
690
  ).absolute()
691
- # help_dump.write_text(runem_stdout_str)
691
+ help_dump.write_text(runem_stdout_str)
692
692
 
693
693
  # we have to strip all whitespace as help adapts to the terminal width
694
694
  stripped_expected_help_output: typing.List[str] = (
@@ -1 +0,0 @@
1
- 0.0.30
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes