From cc24bd724b786eb293224780b1fd8a2dcbfc15af Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Thu, 17 Jun 2021 23:37:12 +0530 Subject: [PATCH 01/16] Added device-name facades --- plyer/facades/devicename.py | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 plyer/facades/devicename.py diff --git a/plyer/facades/devicename.py b/plyer/facades/devicename.py new file mode 100644 index 00000000..85409f1c --- /dev/null +++ b/plyer/facades/devicename.py @@ -0,0 +1,50 @@ +'''DeviceName facade. + +Returns the following depending on the platform: + +* **Android**: Android Device name +* **Linux**: Hostname of the machine +* **Windows**: Hostname of the machine + +Simple Example +-------------- + +To get the unique ID:: + + >>> from plyer import devicename + >>> devicename.device_name + 'Oneplus 3' + +.. versionadded:: 2.0.0 + - first release + + +Supported Platforms +------------------- +Android, Windows, Linux + +''' + + +class DeviceName: + ''' + DeviceName facade. + ''' + + @property + def device_name(self): + ''' + Property that returns the device name of the platform. + ''' + return self.get_device_name() + + def get_device_name(self): + ''' + Public method for getting device name via platform-specific + API in plyer.platforms. + ''' + return self._get_device_name() + + # private + def _get_device_name(self): + raise NotImplementedError() From 42262b640d2a6928058b7e5eeaf60ce6e0782b76 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Thu, 17 Jun 2021 23:37:41 +0530 Subject: [PATCH 02/16] added device-name support for android --- plyer/platforms/android/devicename.py | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 plyer/platforms/android/devicename.py diff --git a/plyer/platforms/android/devicename.py b/plyer/platforms/android/devicename.py new file mode 100644 index 00000000..e37ba126 --- /dev/null +++ b/plyer/platforms/android/devicename.py @@ -0,0 +1,28 @@ +''' +Module of Android API for plyer.devicename. +''' + +from jnius import autoclass +from plyer.platforms.android import activity +from plyer.facades import UniqueID + +Secure = autoclass('android.provider.Global$Secure') + + +class AndroidDeviceName(UniqueID): + ''' + Implementation of Android devicename API. + ''' + + def _get_uid(self): + return Secure.getString( + activity.getContentResolver(), + Secure.DEVICE_NAME + ) + + +def instance(): + ''' + Instance for facade proxy. + ''' + return AndroidDeviceName() From bfcb95eda0085e43cd4432a37f815f0674da0e66 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Thu, 17 Jun 2021 23:41:06 +0530 Subject: [PATCH 03/16] Corrected method name in device-name implementation for Android --- plyer/platforms/android/devicename.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plyer/platforms/android/devicename.py b/plyer/platforms/android/devicename.py index e37ba126..50435a84 100644 --- a/plyer/platforms/android/devicename.py +++ b/plyer/platforms/android/devicename.py @@ -14,7 +14,7 @@ class AndroidDeviceName(UniqueID): Implementation of Android devicename API. ''' - def _get_uid(self): + def _get_device_name(self): return Secure.getString( activity.getContentResolver(), Secure.DEVICE_NAME From 750763cd00db386a5ad323453342ee1612691331 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Thu, 17 Jun 2021 23:42:09 +0530 Subject: [PATCH 04/16] added device-name support for android --- plyer/platforms/android/devicename.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plyer/platforms/android/devicename.py b/plyer/platforms/android/devicename.py index 50435a84..c2636f1e 100644 --- a/plyer/platforms/android/devicename.py +++ b/plyer/platforms/android/devicename.py @@ -4,12 +4,12 @@ from jnius import autoclass from plyer.platforms.android import activity -from plyer.facades import UniqueID +from plyer.facades import DeviceName Secure = autoclass('android.provider.Global$Secure') -class AndroidDeviceName(UniqueID): +class AndroidDeviceName(DeviceName): ''' Implementation of Android devicename API. ''' From da57a4c7e1c49ec148dcfbeca9c03d6c7c66585b Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Thu, 17 Jun 2021 23:48:26 +0530 Subject: [PATCH 05/16] Added linux api for DeviceName --- plyer/platforms/linux/devicename.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plyer/platforms/linux/devicename.py diff --git a/plyer/platforms/linux/devicename.py b/plyer/platforms/linux/devicename.py new file mode 100644 index 00000000..37b49949 --- /dev/null +++ b/plyer/platforms/linux/devicename.py @@ -0,0 +1,25 @@ +''' +Module of Linux API for plyer.devicename. +''' + +import socket +from plyer.facades import DeviceName + +class LinuxDeviceName(DeviceName): + ''' + Implementation of Linux DeviceName API. + ''' + + def _get_device_name(self): + hostname = None + + if not socket.gethostname(): + hostname = socket.gethostname() + + return hostname + +def instance(): + ''' + Instance for facade proxy. + ''' + return LinuxDeviceName() From 5fe1d83234ed3712c37ef48c5f53906716b2cdea Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Thu, 17 Jun 2021 23:48:38 +0530 Subject: [PATCH 06/16] Added Wndows api for DeviceName --- plyer/platforms/win/devicename.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 plyer/platforms/win/devicename.py diff --git a/plyer/platforms/win/devicename.py b/plyer/platforms/win/devicename.py new file mode 100644 index 00000000..198051f2 --- /dev/null +++ b/plyer/platforms/win/devicename.py @@ -0,0 +1,25 @@ +''' +Module of Win API for plyer.devicename. +''' + +import socket +from plyer.facades import DeviceName + +class WinDeviceName(DeviceName): + ''' + Implementation of Linux DeviceName API. + ''' + + def _get_device_name(self): + hostname = None + + if not socket.gethostname(): + hostname = socket.gethostname() + + return hostname + +def instance(): + ''' + Instance for facade proxy. + ''' + return WinDeviceName() From 51b5d6f4f430056929d6ec876b26065989c7fb66 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Fri, 18 Jun 2021 18:47:47 +0530 Subject: [PATCH 07/16] added unit test for devicename --- plyer/tests/test_devicename.py | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 plyer/tests/test_devicename.py diff --git a/plyer/tests/test_devicename.py b/plyer/tests/test_devicename.py new file mode 100644 index 00000000..f1d7e51d --- /dev/null +++ b/plyer/tests/test_devicename.py @@ -0,0 +1,43 @@ +''' +TestDeviceName +============ + +Tested platforms: + +* Windows +''' + +import unittest +from mock import patch, Mock +from plyer.tests.common import PlatformTest, platform_import +import socket + +class TestDeviceName(unittest.TestCase): + ''' + TestCase for plyer.devicename. + ''' + + def test_devicename(self): + ''' + General all platform test for plyer.devicename. + ''' + from plyer import devicename + self.assertTrue(len(devicename.device_name) > 0) + + @PlatformTest('win') + def test_devicename_win(self): + ''' + Test Windows API for plyer.devicename. + ''' + devicename = platform_import( + platform='Win', + module_name='devicename', + ) + + with patch.object(socket, 'gethostname', return_value='mocked_hostname') as mock_method: + evaluated_device_name = devicename.device_name + self.assertEqual(evaluated_device_name, 'mocked_hostname') + + +if __name__ == '__main__': + unittest.main() From fef25bbc23d8de6c1bbfade57056d284b2e511b1 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 00:03:27 +0530 Subject: [PATCH 08/16] Corrected pep8 errors --- plyer/platforms/linux/devicename.py | 4 ++-- plyer/platforms/win/devicename.py | 4 ++-- plyer/tests/test_devicename.py | 9 ++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/plyer/platforms/linux/devicename.py b/plyer/platforms/linux/devicename.py index 37b49949..89d6bfbc 100644 --- a/plyer/platforms/linux/devicename.py +++ b/plyer/platforms/linux/devicename.py @@ -5,6 +5,7 @@ import socket from plyer.facades import DeviceName + class LinuxDeviceName(DeviceName): ''' Implementation of Linux DeviceName API. @@ -12,12 +13,11 @@ class LinuxDeviceName(DeviceName): def _get_device_name(self): hostname = None - if not socket.gethostname(): hostname = socket.gethostname() - return hostname + def instance(): ''' Instance for facade proxy. diff --git a/plyer/platforms/win/devicename.py b/plyer/platforms/win/devicename.py index 198051f2..e2a52f42 100644 --- a/plyer/platforms/win/devicename.py +++ b/plyer/platforms/win/devicename.py @@ -5,6 +5,7 @@ import socket from plyer.facades import DeviceName + class WinDeviceName(DeviceName): ''' Implementation of Linux DeviceName API. @@ -12,12 +13,11 @@ class WinDeviceName(DeviceName): def _get_device_name(self): hostname = None - if not socket.gethostname(): hostname = socket.gethostname() - return hostname + def instance(): ''' Instance for facade proxy. diff --git a/plyer/tests/test_devicename.py b/plyer/tests/test_devicename.py index f1d7e51d..a60307c3 100644 --- a/plyer/tests/test_devicename.py +++ b/plyer/tests/test_devicename.py @@ -12,6 +12,7 @@ from plyer.tests.common import PlatformTest, platform_import import socket + class TestDeviceName(unittest.TestCase): ''' TestCase for plyer.devicename. @@ -33,11 +34,13 @@ def test_devicename_win(self): platform='Win', module_name='devicename', ) - - with patch.object(socket, 'gethostname', return_value='mocked_hostname') as mock_method: + with patch.object(socket, + 'gethostname', + return_value='mocked_hostname' + ) as mock_method: evaluated_device_name = devicename.device_name self.assertEqual(evaluated_device_name, 'mocked_hostname') - + if __name__ == '__main__': unittest.main() From be57825228a6f9a135a8118adfdfc88c489e20f7 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 08:44:54 +0530 Subject: [PATCH 09/16] added proxy for devicename --- plyer/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plyer/__init__.py b/plyer/__init__.py index ce286c75..9e360290 100644 --- a/plyer/__init__.py +++ b/plyer/__init__.py @@ -10,7 +10,7 @@ 'flash', 'gps', 'gravity', 'gyroscope', 'humidity', 'irblaster', 'keystore', 'light', 'notification', 'orientation', 'processors', 'proximity', 'screenshot', 'sms', 'spatialorientation', 'storagepath', - 'stt', 'temperature', 'tts', 'uniqueid', 'vibrator', 'wifi' + 'stt', 'temperature', 'tts', 'uniqueid', 'vibrator', 'wifi', 'devicename' ) __version__ = '2.0.1.dev0' @@ -119,3 +119,6 @@ #: Screenshot proxy to :class:`plyer.facades.Screenshot` screenshot = Proxy('screenshot', facades.Screenshot) + +#: devicename proxy to :class:`plyer.facades.DeviceName` +devicename = Proxy('devicename', facades.DeviceName) From 6e303fb93922f909427950c941e8df65597dc6cc Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 08:45:25 +0530 Subject: [PATCH 10/16] added interface for devicename --- plyer/facades/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plyer/facades/__init__.py b/plyer/facades/__init__.py index 4315dc17..c1e25605 100644 --- a/plyer/facades/__init__.py +++ b/plyer/facades/__init__.py @@ -12,7 +12,7 @@ 'Sms', 'TTS', 'UniqueID', 'Vibrator', 'Wifi', 'Flash', 'CPU', 'Temperature', 'Humidity', 'SpatialOrientation', 'Brightness', 'Processors', 'StoragePath', 'Keystore', 'Bluetooth', 'Screenshot', - 'STT') + 'STT', 'DeviceName') from plyer.facades.accelerometer import Accelerometer from plyer.facades.audio import Audio @@ -48,3 +48,4 @@ from plyer.facades.processors import Processors from plyer.facades.cpu import CPU from plyer.facades.screenshot import Screenshot +from plyer.facades.devicename import DeviceName From 7a28b8f8fead98fe9d4b5bf5161364f2d62a932d Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 14:19:15 +0530 Subject: [PATCH 11/16] Removed unwanted if condition to check the environment hostname --- plyer/platforms/linux/devicename.py | 4 +--- plyer/platforms/win/devicename.py | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/plyer/platforms/linux/devicename.py b/plyer/platforms/linux/devicename.py index 89d6bfbc..89413791 100644 --- a/plyer/platforms/linux/devicename.py +++ b/plyer/platforms/linux/devicename.py @@ -12,9 +12,7 @@ class LinuxDeviceName(DeviceName): ''' def _get_device_name(self): - hostname = None - if not socket.gethostname(): - hostname = socket.gethostname() + hostname = socket.gethostname() return hostname diff --git a/plyer/platforms/win/devicename.py b/plyer/platforms/win/devicename.py index e2a52f42..d35d76bd 100644 --- a/plyer/platforms/win/devicename.py +++ b/plyer/platforms/win/devicename.py @@ -12,9 +12,7 @@ class WinDeviceName(DeviceName): ''' def _get_device_name(self): - hostname = None - if not socket.gethostname(): - hostname = socket.gethostname() + hostname = socket.gethostname() return hostname From 712e7c9fc8b8bcbd5894ceab297656a8ea6ed6fa Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 14:19:46 +0530 Subject: [PATCH 12/16] Corrected unit tests --- plyer/tests/test_devicename.py | 43 ++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/plyer/tests/test_devicename.py b/plyer/tests/test_devicename.py index a60307c3..f07f18b9 100644 --- a/plyer/tests/test_devicename.py +++ b/plyer/tests/test_devicename.py @@ -8,7 +8,7 @@ ''' import unittest -from mock import patch, Mock +from mock import patch from plyer.tests.common import PlatformTest, platform_import import socket @@ -18,28 +18,41 @@ class TestDeviceName(unittest.TestCase): TestCase for plyer.devicename. ''' - def test_devicename(self): - ''' - General all platform test for plyer.devicename. - ''' - from plyer import devicename - self.assertTrue(len(devicename.device_name) > 0) - @PlatformTest('win') def test_devicename_win(self): ''' Test Windows API for plyer.devicename. ''' - devicename = platform_import( - platform='Win', - module_name='devicename', - ) + devicename = platform_import(platform='win', + module_name='devicename' + ) + devicename_instance = devicename.instance() + with patch.object(socket, 'gethostname', - return_value='mocked_hostname' + return_value='mocked_windows_hostname' ) as mock_method: - evaluated_device_name = devicename.device_name - self.assertEqual(evaluated_device_name, 'mocked_hostname') + + evaluated_device_name = devicename_instance._get_device_name() + self.assertEqual(evaluated_device_name, 'mocked_windows_hostname') + + @PlatformTest('linux') + def test_devicename_linux(self): + ''' + Test Linux API for plyer.devicename. + ''' + devicename = platform_import(platform='linux', + module_name='devicename' + ) + devicename_instance = devicename.instance() + + with patch.object(socket, + 'gethostname', + return_value='mocked_linux_hostname' + ) as mock_method: + + evaluated_device_name = devicename_instance._get_device_name() + self.assertEqual(evaluated_device_name, 'mocked_linux_hostname') if __name__ == '__main__': From f92e7b3a52a08a27dbea8b17ec1dc33811dceb5d Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 16:32:53 +0530 Subject: [PATCH 13/16] removed public method from devicename facade and bumped up version number --- plyer/__init__.py | 2 +- plyer/facades/devicename.py | 9 +-------- plyer/tests/test_devicename.py | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/plyer/__init__.py b/plyer/__init__.py index 9e360290..0fea42d3 100644 --- a/plyer/__init__.py +++ b/plyer/__init__.py @@ -13,7 +13,7 @@ 'stt', 'temperature', 'tts', 'uniqueid', 'vibrator', 'wifi', 'devicename' ) -__version__ = '2.0.1.dev0' +__version__ = '2.1.0.dev0' from plyer import facades diff --git a/plyer/facades/devicename.py b/plyer/facades/devicename.py index 85409f1c..f42ac0ab 100644 --- a/plyer/facades/devicename.py +++ b/plyer/facades/devicename.py @@ -15,7 +15,7 @@ >>> devicename.device_name 'Oneplus 3' -.. versionadded:: 2.0.0 +.. versionadded:: 2.1.0 - first release @@ -36,13 +36,6 @@ def device_name(self): ''' Property that returns the device name of the platform. ''' - return self.get_device_name() - - def get_device_name(self): - ''' - Public method for getting device name via platform-specific - API in plyer.platforms. - ''' return self._get_device_name() # private diff --git a/plyer/tests/test_devicename.py b/plyer/tests/test_devicename.py index f07f18b9..0bfcec29 100644 --- a/plyer/tests/test_devicename.py +++ b/plyer/tests/test_devicename.py @@ -33,7 +33,7 @@ def test_devicename_win(self): return_value='mocked_windows_hostname' ) as mock_method: - evaluated_device_name = devicename_instance._get_device_name() + evaluated_device_name = devicename_instance.device_name self.assertEqual(evaluated_device_name, 'mocked_windows_hostname') @PlatformTest('linux') @@ -51,7 +51,7 @@ def test_devicename_linux(self): return_value='mocked_linux_hostname' ) as mock_method: - evaluated_device_name = devicename_instance._get_device_name() + evaluated_device_name = devicename_instance.device_name self.assertEqual(evaluated_device_name, 'mocked_linux_hostname') From 220c6a67f2cac61b091a08c8ac2038daf301eb2c Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 16:33:38 +0530 Subject: [PATCH 14/16] added devicename feature in README.md file --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0fe1e761..2d2ca0b2 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ implement the api in the easiest way, depending on the current platform. | Camera (taking picture) | ✔ | ✔ | | | | | Compass | ✔ | ✔ | | | | | CPU count | | | ✔ | ✔ | ✔ | +| Devicename | ✔ | | ✔ | | ✔ | | Email (open mail client) | ✔ | ✔ | ✔ | ✔ | ✔ | | Flash | ✔ | ✔ | | | | | GPS | ✔ | ✔ | | | | @@ -59,6 +60,7 @@ implement the api in the easiest way, depending on the current platform. | Vibrator | ✔ | ✔ | | | | | Wifi | | | ✔ | ✔ | ✔ | + ## Installation To use on desktop: `pip install plyer` From 0f91da8b6ac11d1be95e23c4628eeca4f2b62572 Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 17:30:44 +0530 Subject: [PATCH 15/16] Added device-name support for MacOSX --- README.md | 2 +- plyer/facades/devicename.py | 3 ++- plyer/platforms/macosx/devicename.py | 23 +++++++++++++++++++++++ plyer/tests/test_devicename.py | 18 ++++++++++++++++++ 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 plyer/platforms/macosx/devicename.py diff --git a/README.md b/README.md index 2d2ca0b2..ee4e8b7b 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ implement the api in the easiest way, depending on the current platform. | Camera (taking picture) | ✔ | ✔ | | | | | Compass | ✔ | ✔ | | | | | CPU count | | | ✔ | ✔ | ✔ | -| Devicename | ✔ | | ✔ | | ✔ | +| Devicename | ✔ | | ✔ | ✔ | ✔ | | Email (open mail client) | ✔ | ✔ | ✔ | ✔ | ✔ | | Flash | ✔ | ✔ | | | | | GPS | ✔ | ✔ | | | | diff --git a/plyer/facades/devicename.py b/plyer/facades/devicename.py index f42ac0ab..cfb0c7c8 100644 --- a/plyer/facades/devicename.py +++ b/plyer/facades/devicename.py @@ -4,6 +4,7 @@ * **Android**: Android Device name * **Linux**: Hostname of the machine +* **OS X**: Hostname of the machine * **Windows**: Hostname of the machine Simple Example @@ -21,7 +22,7 @@ Supported Platforms ------------------- -Android, Windows, Linux +Android, Windows, OS X, Linux ''' diff --git a/plyer/platforms/macosx/devicename.py b/plyer/platforms/macosx/devicename.py new file mode 100644 index 00000000..6652425e --- /dev/null +++ b/plyer/platforms/macosx/devicename.py @@ -0,0 +1,23 @@ +''' +Module of MacOSX API for plyer.devicename. +''' + +import socket +from plyer.facades import DeviceName + + +class OSXDeviceName(DeviceName): + ''' + Implementation of MacOSX DeviceName API. + ''' + + def _get_device_name(self): + hostname = socket.gethostname() + return hostname + + +def instance(): + ''' + Instance for facade proxy. + ''' + return OSXDeviceName() diff --git a/plyer/tests/test_devicename.py b/plyer/tests/test_devicename.py index 0bfcec29..28320361 100644 --- a/plyer/tests/test_devicename.py +++ b/plyer/tests/test_devicename.py @@ -54,6 +54,24 @@ def test_devicename_linux(self): evaluated_device_name = devicename_instance.device_name self.assertEqual(evaluated_device_name, 'mocked_linux_hostname') + @PlatformTest('macosx') + def test_devicename_macosx(self): + ''' + Test MacOSX API for plyer.devicename. + ''' + devicename = platform_import(platform='macosx', + module_name='devicename' + ) + devicename_instance = devicename.instance() + + with patch.object(socket, + 'gethostname', + return_value='mocked_macosx_hostname' + ) as mock_method: + + evaluated_device_name = devicename_instance.device_name + self.assertEqual(evaluated_device_name, 'mocked_macosx_hostname') + if __name__ == '__main__': unittest.main() From 3554346394ad9eb6530ca72493b52f937eed9f3d Mon Sep 17 00:00:00 2001 From: Lakhya Jyoti Nath Date: Sat, 19 Jun 2021 18:00:21 +0530 Subject: [PATCH 16/16] fixed style error in devicename tests --- plyer/tests/test_devicename.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plyer/tests/test_devicename.py b/plyer/tests/test_devicename.py index 28320361..cbb0fc4b 100644 --- a/plyer/tests/test_devicename.py +++ b/plyer/tests/test_devicename.py @@ -31,7 +31,7 @@ def test_devicename_win(self): with patch.object(socket, 'gethostname', return_value='mocked_windows_hostname' - ) as mock_method: + ) as _: evaluated_device_name = devicename_instance.device_name self.assertEqual(evaluated_device_name, 'mocked_windows_hostname') @@ -49,7 +49,7 @@ def test_devicename_linux(self): with patch.object(socket, 'gethostname', return_value='mocked_linux_hostname' - ) as mock_method: + ) as _: evaluated_device_name = devicename_instance.device_name self.assertEqual(evaluated_device_name, 'mocked_linux_hostname') @@ -67,7 +67,7 @@ def test_devicename_macosx(self): with patch.object(socket, 'gethostname', return_value='mocked_macosx_hostname' - ) as mock_method: + ) as _: evaluated_device_name = devicename_instance.device_name self.assertEqual(evaluated_device_name, 'mocked_macosx_hostname')