approvaltests 15.3.2.dev3__tar.gz → 15.3.2.dev4__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 (135) hide show
  1. approvaltests-15.3.2.dev4/PKG-INFO +370 -0
  2. approvaltests-15.3.2.dev4/approvaltests/verifiable_objects/__init__.py +0 -0
  3. approvaltests-15.3.2.dev4/approvaltests/version.py +1 -0
  4. approvaltests-15.3.2.dev4/approvaltests.egg-info/PKG-INFO +370 -0
  5. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests.egg-info/SOURCES.txt +28 -1
  6. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests.egg-info/entry_points.txt +0 -1
  7. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests.egg-info/requires.txt +1 -1
  8. approvaltests-15.3.2.dev4/tests/test_approvaltests_temp_dir.py +8 -0
  9. approvaltests-15.3.2.dev4/tests/test_asserts.py +68 -0
  10. approvaltests-15.3.2.dev4/tests/test_build.py +33 -0
  11. approvaltests-15.3.2.dev4/tests/test_combinations.py +175 -0
  12. approvaltests-15.3.2.dev4/tests/test_compare_file_lists.py +30 -0
  13. approvaltests-15.3.2.dev4/tests/test_custom_printers.py +41 -0
  14. approvaltests-15.3.2.dev4/tests/test_example_numpy.py +60 -0
  15. approvaltests-15.3.2.dev4/tests/test_exception_utils.py +22 -0
  16. approvaltests-15.3.2.dev4/tests/test_fileapprover.py +114 -0
  17. approvaltests-15.3.2.dev4/tests/test_find_stale_approved_files.py +136 -0
  18. approvaltests-15.3.2.dev4/tests/test_inline_approvals.py +263 -0
  19. approvaltests-15.3.2.dev4/tests/test_list.py +40 -0
  20. approvaltests-15.3.2.dev4/tests/test_multiline_string_utils.py +35 -0
  21. approvaltests-15.3.2.dev4/tests/test_namer.py +70 -0
  22. approvaltests-15.3.2.dev4/tests/test_options.py +118 -0
  23. approvaltests-15.3.2.dev4/tests/test_pairwise_combinations.py +108 -0
  24. approvaltests-15.3.2.dev4/tests/test_parse_inputs.py +147 -0
  25. approvaltests-15.3.2.dev4/tests/test_python_patterns.py +20 -0
  26. approvaltests-15.3.2.dev4/tests/test_scenarios.py +73 -0
  27. approvaltests-15.3.2.dev4/tests/test_simple_logger.py +266 -0
  28. approvaltests-15.3.2.dev4/tests/test_split_code.py +67 -0
  29. approvaltests-15.3.2.dev4/tests/test_verify.py +341 -0
  30. approvaltests-15.3.2.dev4/tests/test_verify_all.py +10 -0
  31. approvaltests-15.3.2.dev4/tests/test_verify_argument_parser.py +14 -0
  32. approvaltests-15.3.2.dev4/tests/test_workflow_matrix.py +40 -0
  33. approvaltests-15.3.2.dev4/tests/test_writer.py +31 -0
  34. approvaltests-15.3.2.dev4/version.py +1 -0
  35. approvaltests-15.3.2.dev3/PKG-INFO +0 -352
  36. approvaltests-15.3.2.dev3/approvaltests/version.py +0 -1
  37. approvaltests-15.3.2.dev3/approvaltests.egg-info/PKG-INFO +0 -352
  38. approvaltests-15.3.2.dev3/version.py +0 -1
  39. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/LICENSE +0 -0
  40. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/MANIFEST.in +0 -0
  41. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/README.md +0 -0
  42. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/__init__.py +0 -0
  43. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/__main__.py +0 -0
  44. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/approval_exception.py +0 -0
  45. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/approvals.py +0 -0
  46. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/asserts.py +0 -0
  47. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/binary_writer.py +0 -0
  48. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/combination_approvals.py +0 -0
  49. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/command.py +0 -0
  50. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/commandline_interface.py +0 -0
  51. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/__init__.py +0 -0
  52. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/comparator.py +0 -0
  53. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/format_wrapper.py +0 -0
  54. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/namer.py +0 -0
  55. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/options.py +0 -0
  56. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/reporter.py +0 -0
  57. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/scenario_namer.py +0 -0
  58. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/core/writer.py +0 -0
  59. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/existing_file_writer.py +0 -0
  60. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/file_approver.py +0 -0
  61. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/__init__.py +0 -0
  62. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/inline_options.py +0 -0
  63. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/markers.py +0 -0
  64. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/parse.py +0 -0
  65. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/parse2.py +0 -0
  66. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/parse3.py +0 -0
  67. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/parse_docstring.py +0 -0
  68. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/split_code.py +0 -0
  69. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/inline/types.py +0 -0
  70. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/integrations/__init__.py +0 -0
  71. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/integrations/pytest/__init__.py +0 -0
  72. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/integrations/pytest/py_test_namer.py +0 -0
  73. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/integrations/pytest/pytest_config.py +0 -0
  74. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/integrations/pytest/pytest_plugin.py +0 -0
  75. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/internals/__init__.py +0 -0
  76. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/internals/logs/__init__.py +0 -0
  77. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/internals/logs/approved_file_log.py +0 -0
  78. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/internals/logs/failed_comparison_log.py +0 -0
  79. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/internals/logs/log_commons.py +0 -0
  80. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/__init__.py +0 -0
  81. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/cli_namer.py +0 -0
  82. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/default_name.py +0 -0
  83. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/default_namer_factory.py +0 -0
  84. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/inline_comparator.py +0 -0
  85. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/inline_python_reporter.py +0 -0
  86. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/namer_base.py +0 -0
  87. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/namer/stack_frame_namer.py +0 -0
  88. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/pairwise_combinations.py +0 -0
  89. /approvaltests-15.3.2.dev3/approvaltests/utilities/__init__.py → /approvaltests-15.3.2.dev4/approvaltests/py.typed +0 -0
  90. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporter_missing_exception.py +0 -0
  91. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/__init__.py +0 -0
  92. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/clipboard_reporter.py +0 -0
  93. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/default_reporter_factory.py +0 -0
  94. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/diff_reporter.py +0 -0
  95. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/executable_command_reporter.py +0 -0
  96. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/file_capture_reporter.py +0 -0
  97. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/first_working_reporter.py +0 -0
  98. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/generic_diff_reporter.py +0 -0
  99. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/generic_diff_reporter_config.py +0 -0
  100. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/generic_diff_reporter_factory.py +0 -0
  101. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/multi_reporter.py +0 -0
  102. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/python_native_reporter.py +0 -0
  103. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/received_file_launcher_reporter.py +0 -0
  104. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_all_to_clipboard.py +0 -0
  105. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_by_creating_diff_file.py +0 -0
  106. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_on_cyber_dojo.py +0 -0
  107. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_quietly.py +0 -0
  108. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_to_diff_engine.py +0 -0
  109. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_with_beyond_compare.py +0 -0
  110. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_with_diff_command_line.py +0 -0
  111. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_with_diff_tool_on_windows.py +0 -0
  112. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/report_with_vscode.py +0 -0
  113. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/reporter_that_automatically_approves.py +0 -0
  114. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/reporter_that_creates_an_approval_script.py +0 -0
  115. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/reporters.json +0 -0
  116. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/reporters/testing_reporter.py +0 -0
  117. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/scrubbers/__init__.py +0 -0
  118. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/scrubbers/date_scrubber.py +0 -0
  119. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/scrubbers/scrubbers.py +0 -0
  120. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/storyboard.py +0 -0
  121. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/string_writer.py +0 -0
  122. {approvaltests-15.3.2.dev3/approvaltests/utilities/logger → approvaltests-15.3.2.dev4/approvaltests/utilities}/__init__.py +0 -0
  123. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/utilities/command_line_approvals.py +0 -0
  124. {approvaltests-15.3.2.dev3/approvaltests/utilities/logging → approvaltests-15.3.2.dev4/approvaltests/utilities/logger}/__init__.py +0 -0
  125. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/utilities/logger/simple_logger_approvals.py +0 -0
  126. {approvaltests-15.3.2.dev3/approvaltests/verifiable_objects → approvaltests-15.3.2.dev4/approvaltests/utilities/logging}/__init__.py +0 -0
  127. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/utilities/logging/logging_approvals.py +0 -0
  128. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests/verifiable_objects/formatter_of_argparse_namespace.py +0 -0
  129. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests.egg-info/dependency_links.txt +0 -0
  130. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/approvaltests.egg-info/top_level.txt +0 -0
  131. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/requirements.prod.extras.txt +0 -0
  132. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/requirements.prod.required.txt +0 -0
  133. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/requirements.prod.txt +0 -0
  134. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/setup/setup_utils.py +0 -0
  135. {approvaltests-15.3.2.dev3 → approvaltests-15.3.2.dev4}/setup.cfg +0 -0
@@ -0,0 +1,370 @@
1
+ Metadata-Version: 2.4
2
+ Name: approvaltests
3
+ Version: 15.3.2.dev4
4
+ Summary: Assertion/verification library to aid testing
5
+ Home-page: https://github.com/approvals/ApprovalTests.Python
6
+ Author: ApprovalTests Contributors
7
+ Author-email: llewellyn.falco@gmail.com
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: License :: OSI Approved :: Apache Software License
11
+ Classifier: Operating System :: POSIX
12
+ Classifier: Operating System :: Microsoft :: Windows
13
+ Classifier: Operating System :: MacOS :: MacOS X
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: Software Development :: Testing
22
+ Classifier: Topic :: Utilities
23
+ Requires-Python: >=3.8
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: pytest>=4.0.0
27
+ Requires-Dist: empty-files>=0.0.3
28
+ Requires-Dist: typing_extensions>=3.6.2
29
+ Requires-Dist: pyperclip>=1.5.29
30
+ Requires-Dist: beautifulsoup4>=4.4.0
31
+ Requires-Dist: allpairspy>=2.1.0
32
+ Requires-Dist: testfixtures>=7.1.0
33
+ Requires-Dist: mock>=5.1.0
34
+ Requires-Dist: approval_utilities==5.3.2-dev4
35
+ Dynamic: author
36
+ Dynamic: author-email
37
+ Dynamic: classifier
38
+ Dynamic: description
39
+ Dynamic: description-content-type
40
+ Dynamic: home-page
41
+ Dynamic: license-file
42
+ Dynamic: requires-dist
43
+ Dynamic: requires-python
44
+ Dynamic: summary
45
+
46
+ # ApprovalTests.Python
47
+
48
+ <!-- toc -->
49
+ ## Contents
50
+
51
+ * [What can I use ApprovalTests for?](#what-can-i-use-approvaltests-for)
52
+ * [Getting Started](#getting-started)
53
+ * [What Are Approvals](#what-are-approvals)
54
+ * [New Projects](#new-projects)
55
+ * [Minimal Example Tutorial](#minimal-example-tutorial)
56
+ * [Adding to Existing Projects](#adding-to-existing-projects)
57
+ * [Overview](#overview)
58
+ * [Example using pytest](#example-using-pytest)
59
+ * [Example using unittest](#example-using-unittest)
60
+ * [Example using CLI](#example-using-cli)
61
+ * [Usage](#usage)
62
+ * [Argument Definitions](#argument-definitions)
63
+ * [Reporters](#reporters)
64
+ * [Selecting a Reporter](#selecting-a-reporter)
65
+ * [JSON file for collection of reporters](#json-file-for-collection-of-reporters)
66
+ * [Support and Documentation](#support-and-documentation)
67
+ * [Missing Documentation?](#missing-documentation)
68
+ * [Dependencies](#dependencies)
69
+ * [Required dependencies](#required-dependencies)
70
+ * [Extra dependencies](#extra-dependencies)
71
+ * [For developers](#for-developers)
72
+ * [Weekly Ensemble](#weekly-ensemble)
73
+ * [Pull Requests](#pull-requests)<!-- endToc -->
74
+
75
+ Capturing Human Intelligence - ApprovalTests is an open source assertion/verification library to aid testing.
76
+ `approvaltests` is the ApprovalTests port for Python.
77
+
78
+ For more information see: [www.approvaltests.com](http://approvaltests.com/).
79
+
80
+ [![PyPI version](https://img.shields.io/pypi/v/approvaltests.svg)](https://pypi.org/project/approvaltests)
81
+ [![Python versions](https://img.shields.io/pypi/pyversions/approvaltests.svg)](https://pypi.org/project/approvaltests)
82
+ [![Build Status](https://github.com/approvals/ApprovalTests.Python/workflows/Test/badge.svg?branch=master)](https://github.com/approvals/ApprovalTests.Python/actions)
83
+ [![Build Status](https://github.com/approvals/ApprovalTests.Python/workflows/on-push-do-doco/badge.svg)](https://github.com/approvals/ApprovalTests.Python/actions?query=workflow%3Aon-push-do-doco)
84
+ [![Build Status](https://github.com/approvals/ApprovalTests.Python/workflows/Upload%20Python%20Package/badge.svg)](https://github.com/approvals/ApprovalTests.Python/actions?query=workflow%3A%22Upload+Python+Package%22)
85
+ [![Discord](https://img.shields.io/discord/1349240939406819409?logo=discord)](https://discord.gg/XDrgy6x6Se)
86
+
87
+ ## What can I use ApprovalTests for?
88
+
89
+ You can use ApprovalTests to verify objects that require more than a simple assert including long strings, large arrays,
90
+ and complex hash structures and objects. ApprovalTests really shines when you need a more granular look at the test
91
+ failure. Sometimes, trying to find a small difference in a long string printed to STDOUT is just too hard!
92
+ ApprovalTests solves this problem by providing reporters which let you view the test results in one of many popular diff
93
+ utilities.
94
+
95
+ ## Getting Started
96
+
97
+ ### What Are Approvals
98
+
99
+ If you need to gain a better understanding or are new to this concept, start [here](https://github.com/approvals/ApprovalTests.Documentation/blob/main/explanations/what_are_approvals.md).
100
+
101
+ ### New Projects
102
+
103
+ If you are starting a new project, we suggest you use the [Starter Project](https://github.com/approvals/ApprovalTests.Python.StarterProject).
104
+ You can just clone this and go. It's great for exercises, katas, and green field projects.
105
+
106
+ #### Minimal Example Tutorial
107
+
108
+ If this is first time approvaltesting in python, consider starting here: [Minimal Example Tutorial](docs/tutorial/minimal-example.md)
109
+
110
+ ### Adding to Existing Projects
111
+
112
+ From [pypi](https://pypi.org/project/approvaltests/):
113
+
114
+ pip install approvaltests
115
+
116
+ ## Overview
117
+
118
+ Approvals work by comparing the test results to a golden master. If no golden master exists you can create a snapshot
119
+ of the current test results and use that as the golden master. The reporter helps you manage the golden master.
120
+ Whenever your current results differ from the golden master, Approvals will launch an external application for you to
121
+ examine the differences. Either you will update the master because you expected the changes and they are good,
122
+ or you will go back to your code and update or roll back your changes to get your results back in line with the
123
+ golden master.
124
+
125
+ ### Example using pytest
126
+
127
+ <!-- snippet: getting_started_with_pytest.py -->
128
+ <a id='snippet-getting_started_with_pytest.py'></a>
129
+ ```py
130
+ from approvaltests.approvals import verify
131
+
132
+
133
+ def test_simple() -> None:
134
+ result = "Hello ApprovalTests"
135
+ verify(result)
136
+ ```
137
+ <sup><a href='/tests/examples/getting_started_with_pytest.py#L1-L6' title='Snippet source file'>snippet source</a> | <a href='#snippet-getting_started_with_pytest.py' title='Start of snippet'>anchor</a></sup>
138
+ <!-- endSnippet -->
139
+
140
+ Install the plugin pytest-approvaltests and use it to select a reporter:
141
+
142
+ pip install pytest-approvaltests
143
+ pytest --approvaltests-use-reporter='PythonNative'
144
+
145
+ The reporter is used both to alert you to changes in your test output, and to provide a tool to update the golden
146
+ master. In this snippet, we chose the 'PythonNative' reporter when we ran the tests. For more information about selecting
147
+ reporters see [the documentation](https://github.com/approvals/ApprovalTests.Python.PytestPlugin)
148
+
149
+ ### Example using unittest
150
+
151
+ <!-- snippet: getting_started_with_unittest.py -->
152
+ <a id='snippet-getting_started_with_unittest.py'></a>
153
+ ```py
154
+ import unittest
155
+
156
+ from approvaltests.approvals import verify
157
+
158
+
159
+ class GettingStartedTest(unittest.TestCase):
160
+ def test_simple(self) -> None:
161
+ verify("Hello ApprovalTests")
162
+
163
+
164
+ if __name__ == "__main__":
165
+ unittest.main()
166
+ ```
167
+ <sup><a href='/tests/examples/getting_started_with_unittest.py#L1-L12' title='Snippet source file'>snippet source</a> | <a href='#snippet-getting_started_with_unittest.py' title='Start of snippet'>anchor</a></sup>
168
+ <!-- endSnippet -->
169
+
170
+ This example has the same behaviour as the pytest version, but uses the built-in test framework `unittest` instead.
171
+
172
+ ### Example using CLI
173
+
174
+ You can invoke a verify() call from the command line. This allows invoking python approvals from any other stack via subprocesses.
175
+
176
+ #### Usage
177
+
178
+ ```
179
+ python -m approvaltests --test-id hello --received "hello world!"
180
+ ```
181
+
182
+ or
183
+
184
+ ```
185
+ python -m approvaltests -t hello -r "hello world!"
186
+ ```
187
+
188
+ or
189
+
190
+ ```
191
+ echo "hello world!" | python -m approvaltests -t hello
192
+ ```
193
+
194
+ #### Argument Definitions
195
+
196
+ - **`--test-id`** or **`-t`**: Test identifier used to name the `approved.txt` and `received.txt` files for the test.
197
+
198
+ - **`--received`** or **`-r`**: The output of the program under test (a string) that is passed to the verify method.
199
+
200
+ - **`stdin`**: Instead of providing a `received` argument, you may use `stdin`.
201
+
202
+ ## Reporters
203
+
204
+ ### Selecting a Reporter
205
+
206
+ All verify functions take an optional `options` parameter that can configure reporters (as well as many other aspects).
207
+
208
+ ApprovalTests.Python comes with a few reporters configured, supporting Linux, Mac OSX, and Windows.
209
+
210
+ In the example shown below, we pass in an options with a reporter we're selecting directly:
211
+
212
+ <!-- snippet: select_reporter_from_class -->
213
+ <a id='snippet-select_reporter_from_class'></a>
214
+ ```py
215
+ class TestSelectReporterFromClass(unittest.TestCase):
216
+ def test_simple(self):
217
+ verify("Hello", options=Options().with_reporter(report_with_beyond_compare()))
218
+ ```
219
+ <sup><a href='/tests/samples/test_getting_started.py#L28-L34' title='Snippet source file'>snippet source</a> | <a href='#snippet-select_reporter_from_class' title='Start of snippet'>anchor</a></sup>
220
+ <!-- endSnippet -->
221
+
222
+ You can also use the `GenericDiffReporterFactory` to find and select the first diff utility that exists on our system.
223
+
224
+ An advantage of this method is you can modify the reporters.json file directly to handle your unique system.
225
+
226
+ <!-- snippet: select_reporter_from_factory -->
227
+ <a id='snippet-select_reporter_from_factory'></a>
228
+ ```py
229
+ class TestSelectReporter(unittest.TestCase):
230
+ @override
231
+ def setUp(self):
232
+ self.factory = GenericDiffReporterFactory()
233
+
234
+ def test_simple(self):
235
+ verify(
236
+ "Hello", options=Options().with_reporter(self.factory.get("BeyondCompare"))
237
+ )
238
+ ```
239
+ <sup><a href='/tests/samples/test_getting_started.py#L13-L25' title='Snippet source file'>snippet source</a> | <a href='#snippet-select_reporter_from_factory' title='Start of snippet'>anchor</a></sup>
240
+ <!-- endSnippet -->
241
+
242
+ Or you can build your own GenericDiffReporter on the fly
243
+
244
+ <!-- snippet: custom_generic_diff_reporter -->
245
+ <a id='snippet-custom_generic_diff_reporter'></a>
246
+ ```py
247
+ class GettingStartedTest(unittest.TestCase):
248
+ def test_simple(self):
249
+ verify(
250
+ "Hello",
251
+ options=Options().with_reporter(
252
+ GenericDiffReporter.create(r"C:\my\favorite\diff\utility.exe")
253
+ ),
254
+ )
255
+ ```
256
+ <sup><a href='/tests/samples/test_getting_started.py#L37-L48' title='Snippet source file'>snippet source</a> | <a href='#snippet-custom_generic_diff_reporter' title='Start of snippet'>anchor</a></sup>
257
+ <!-- endSnippet -->
258
+
259
+ As long as `C:/my/favorite/diff/utility.exe` can be invoked from the command line using the format `utility.exe file1 file2`
260
+ then it will be compatible with GenericDiffReporter. Otherwise you will have to derive your own reporter, which
261
+ we won't cover here.
262
+
263
+ ### JSON file for collection of reporters
264
+
265
+ To wrap things up, I should note that you can completely replace the collection of reporters known to the reporter
266
+ factory by writing your own JSON file and loading it.
267
+
268
+ For example if you had `C:/myreporters.json`
269
+
270
+ ```json
271
+ [
272
+ ["BeyondCompare4", "C:/Program Files (x86)/Beyond Compare 4/BCompare.exe"],
273
+ ["WinMerge", "C:/Program Files (x86)/WinMerge/WinMergeU.exe"],
274
+ ["Tortoise", "C:/Program Files (x86)/TortoiseSVN/bin/tortoisemerge.exe"]
275
+ ]
276
+ ```
277
+
278
+ You could then use that file by loading it into the factory:
279
+
280
+ ```python
281
+
282
+ import unittest
283
+
284
+ from approvaltests.approvals import verify
285
+ from approvaltests.reporters.generic_diff_reporter_factory import GenericDiffReporterFactory
286
+
287
+
288
+ class GettingStartedTest(unittest.TestCase):
289
+ def setUp(self):
290
+ factory = GenericDiffReporterFactory()
291
+ factory.load('C:/myreporters.json')
292
+ self.reporter = factory.get_first_working()
293
+
294
+ def test_simple(self):
295
+ verify('Hello', self.reporter)
296
+
297
+ if __name__ == "__main__":
298
+ unittest.main()
299
+ ```
300
+
301
+ Of course, if you have some interesting new reporters in `myreporters.json` then please consider updating the
302
+ `reporters.json` file that ships with Approvals and submitting a pull request.
303
+
304
+ ## Support and Documentation
305
+
306
+ - [Documentation](/docs/README.md)
307
+
308
+ - GitHub: [https://github.com/approvals/ApprovalTests.Python](https://github.com/approvals/ApprovalTests.Python)
309
+
310
+ - ApprovalTests Homepage: [http://www.approvaltests.com](http://www.approvaltests.com)
311
+
312
+ ### Missing Documentation?
313
+
314
+ If there is documentation you wish existed, please add a `page request` to [this issue](https://github.com/approvals/ApprovalTests.Python/issues/135).
315
+
316
+ ### Dependencies
317
+
318
+ ApprovalTests is tested on the following Python versions: 3.8, 3.9, 3.10, 3.11, 3.12, 3.13.<!-- singleLineInclude: tests/approved_files/test_workflow_matrix.test_workflow_matrix_python_versions.approved.txt -->
319
+
320
+ ApprovalTests requires the following dependencies:
321
+
322
+ #### Required dependencies
323
+
324
+ These dependencies are always required for approvaltests
325
+
326
+ <!-- snippet: requirements.prod.required.txt -->
327
+ <a id='snippet-requirements.prod.required.txt'></a>
328
+ ```txt
329
+ pytest>=4.0.0
330
+ empty-files>=0.0.3
331
+ typing_extensions>=3.6.2
332
+ ```
333
+ <sup><a href='/requirements.prod.required.txt#L1-L5' title='Snippet source file'>snippet source</a> | <a href='#snippet-requirements.prod.required.txt' title='Start of snippet'>anchor</a></sup>
334
+ <!-- endSnippet -->
335
+
336
+ #### Extra dependencies
337
+
338
+ These dependencies are required if you are going to use the related functionality
339
+ If you want the bare minimum you can use the pypi project
340
+ [approvaltests-minimal](https://pypi.org/project/approvaltests-minimal/)
341
+
342
+ <!-- snippet: requirements.prod.extras.txt -->
343
+ <a id='snippet-requirements.prod.extras.txt'></a>
344
+ ```txt
345
+ pyperclip>=1.5.29 # For Clipboard Reporter
346
+ beautifulsoup4>=4.4.0 # For verify_html
347
+ allpairspy>=2.1.0 # For PairwiseCombinations
348
+ testfixtures >= 7.1.0 # For verify_logging
349
+ mock >= 5.1.0 # For verify_logging
350
+ ```
351
+ <sup><a href='/requirements.prod.extras.txt#L1-L5' title='Snippet source file'>snippet source</a> | <a href='#snippet-requirements.prod.extras.txt' title='Start of snippet'>anchor</a></sup>
352
+ <!-- endSnippet -->
353
+
354
+ ## For developers
355
+
356
+ ### Weekly Ensemble
357
+
358
+ The best way to contribute is to [join our weekly mob/ensemble](./docs/Contribute.md).
359
+
360
+ ### Pull Requests
361
+
362
+ Pull requests are welcomed, particularly those accompanied by automated tests.
363
+
364
+ To run the self-tests:
365
+ `./build_and_test.sh`
366
+
367
+ This will run the self-tests on several python versions. We support python 3.8 and above.
368
+
369
+ All pull requests will be pre-checked using GitHub actions to execute all these tests. You can see the [results of test
370
+ runs here](https://github.com/approvals/ApprovalTests.Python/actions).
@@ -0,0 +1 @@
1
+ version_number = "v15.3.2-dev4"