summaryrefslogtreecommitdiffstats
path: root/third_party/python/distro/CONTRIBUTING.md
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /third_party/python/distro/CONTRIBUTING.md
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/python/distro/CONTRIBUTING.md')
-rw-r--r--third_party/python/distro/CONTRIBUTING.md54
1 files changed, 54 insertions, 0 deletions
diff --git a/third_party/python/distro/CONTRIBUTING.md b/third_party/python/distro/CONTRIBUTING.md
new file mode 100644
index 0000000000..4948ef24e9
--- /dev/null
+++ b/third_party/python/distro/CONTRIBUTING.md
@@ -0,0 +1,54 @@
+# General
+
+* Contributing to distro identification currently doesn't have any specific standards and rather depends on the specific implementation.
+* A 100% coverage is expected for each PR unless explicitly authorized by the reviewer.
+* Please try to maintain maximum code-health (via landscape.io).
+
+# Contributing distro specific tests
+
+Distro's tests are implemented via a standardized framework under `tests/test_distro.py`
+
+For each distribution, tests should be added in the relevant class according to which distribution file(s) exists on it, so, for example, tests should be added under `TestOSRelease` where `/etc/os-release` is available.
+
+The tests must be self-contained, meaning that the release files for the distribution should be maintained in the repository under `tests/resources/distros/distribution_name+distribution_version`.
+
+A tests method would like somewhat like this:
+
+```python
+def test_centos7_os_release(self):
+ desired_outcome = {
+ 'id': 'centos',
+ 'name': 'CentOS Linux',
+ 'pretty_name': 'CentOS Linux 7 (Core)',
+ 'version': '7',
+ 'pretty_version': '7 (Core)',
+ 'best_version': '7',
+ 'like': 'rhel fedora',
+ 'codename': 'Core'
+ }
+ self._test_outcome(desired_outcome)
+```
+
+The framework will automatically try to pick up the relevant file according to the method's name (`centos7` meaning the folder should be named `centos7` as well) and compare the `desired_outcome` with the parsed files found under the test dir.
+
+The exception to the rule is under the `TestDistroRelease` test class which should look somewhat like this:
+
+```python
+def test_centos5_dist_release(self):
+ desired_outcome = {
+ 'id': 'centos',
+ 'name': 'CentOS',
+ 'pretty_name': 'CentOS 5.11 (Final)',
+ 'version': '5.11',
+ 'pretty_version': '5.11 (Final)',
+ 'best_version': '5.11',
+ 'codename': 'Final',
+ 'major_version': '5',
+ 'minor_version': '11'
+ }
+ self._test_outcome(desired_outcome, 'centos', '5')
+```
+
+Where the name of the method is not indicative of the lookup folder but rather tha two last arguments in `_test_outcome`.
+
+A test case is mandatory under `TestOverall` for a PR to be complete. \ No newline at end of file