Test failure: test_platform

Bug #1655200 reported by Anthony Sottile
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3.6 (Ubuntu)
New
Undecided
Unassigned

Bug Description

```
# python3.6 -m test test_platform -v
== CPython 3.6.0 (default, Dec 29 2016, 04:29:02) [GCC 6.2.1 20161215]
== Linux-4.4.0-57-generic-x86_64-with-Ubuntu-17.04-zesty little-endian
== hash algorithm: siphash24 64bit
== cwd: /tmp/test_python_410
== encodings: locale=ANSI_X3.4-1968, FS=ascii
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_platform
test_dist_deprecation (test.test_platform.DeprecationTest) ... ok
test_linux_distribution_deprecation (test.test_platform.DeprecationTest) ... ok
test_architecture (test.test_platform.PlatformTest) ... ok
test_architecture_via_symlink (test.test_platform.PlatformTest) ... ok
test_dist (test.test_platform.PlatformTest) ... ok
test_java_ver (test.test_platform.PlatformTest) ... ok
test_libc_ver (test.test_platform.PlatformTest) ... ok
test_linux_distribution_encoding (test.test_platform.PlatformTest) ... FAIL
test_mac_ver (test.test_platform.PlatformTest) ... ok
test_mac_ver_with_fork (test.test_platform.PlatformTest) ... skipped 'OSX only test'
test_machine (test.test_platform.PlatformTest) ... ok
test_node (test.test_platform.PlatformTest) ... ok
test_parse_release_file (test.test_platform.PlatformTest) ... ok
test_platform (test.test_platform.PlatformTest) ... ok
test_popen (test.test_platform.PlatformTest) ... ok
test_processor (test.test_platform.PlatformTest) ... ok
test_release (test.test_platform.PlatformTest) ... ok
test_sys_version (test.test_platform.PlatformTest) ... ok
test_system (test.test_platform.PlatformTest) ... ok
test_system_alias (test.test_platform.PlatformTest) ... ok
test_uname (test.test_platform.PlatformTest) ... ok
test_uname_win32_ARCHITEW6432 (test.test_platform.PlatformTest) ... skipped 'windows only test'
test_version (test.test_platform.PlatformTest) ... ok
test_win32_ver (test.test_platform.PlatformTest) ... ok

======================================================================
FAIL: test_linux_distribution_encoding (test.test_platform.PlatformTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.6/test/test_platform.py", line 348, in test_linux_distribution_encoding
    self.assertEqual(distname, 'Fedora')
AssertionError: 'Ubuntu' != 'Fedora'
- Ubuntu
+ Fedora

----------------------------------------------------------------------
Ran 24 tests in 0.724s

FAILED (failures=1, skipped=2)
test test_platform failed
test_platform failed

1 test failed:
    test_platform

Total duration: 860 ms
Tests result: FAILURE

```

This test can be "fixed" by modifying the platform-lsbrelease.diff patch in the following way:

```diff
diff --git a/debian/patches/platform-lsbrelease.diff b/debian/patches/platform-lsbrelease.diff
index 5b9b5a8..fe66d9a 100644
--- a/debian/patches/platform-lsbrelease.diff
+++ b/debian/patches/platform-lsbrelease.diff
@@ -31,7 +31,7 @@ Index: b/Lib/platform.py
 + # check for the Debian/Ubuntu /etc/lsb-release file first, needed so
 + # that the distribution doesn't get identified as Debian.
 + try:
-+ with open("/etc/lsb-release", "r") as etclsbrel:
++ with open(os.path.join(_UNIXCONFDIR, "lsb-release"), "r") as etclsbrel:
 + for line in etclsbrel:
 + m = _distributor_id_file_re.search(line)
 + if m:
```

Other information:

I'm using the ubuntu:zesty docker image:

```
# lsb_release -rd
Description: Ubuntu Zesty Zapus (development branch)
Release: 17.04
# apt-cache policy python3.6
python3.6:
  Installed: 3.6.0-1
  Candidate: 3.6.0-1
  Version table:
 *** 3.6.0-1 500
        500 http://archive.ubuntu.com/ubuntu zesty/universe amd64 Packages
        100 /var/lib/dpkg/status
```

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.