Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Irene Bandera <[email protected]>
  • Loading branch information
irenebm committed Jun 9, 2023
1 parent ba9430e commit 6022d37
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions py_utils/test/py_utils/import/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import py_utils.debugging.debug_utils # noqa: F401
import py_utils.logging.log_utils # noqa: F401
import py_utils.system.system_utils # noqa: F401
import py_utils.time.Timer # noqa: F401
import py_utils.wait.WaitHandler # noqa: F401
import py_utils.wait.BooleanWaitHandler # noqa: F401
Expand Down
53 changes: 53 additions & 0 deletions py_utils/test/py_utils/unittest/system/test_System.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2023 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
Test system_utils methods.
"""

import os
from py_utils.system.system_utils import is_linux, is_windows


def test_is_linux():
# Test case 1: Running the script on a Linux system
os.name = 'posix'
assert(is_linux() is True)

# Test case 2: Running the script on a Windows system
os.name = 'nt'
assert(is_linux() is False)

# Test case 3: Running the script on a different operating system
os.name = 'mac'
assert(is_linux() is False)


def test_is_windows():
# Test case 1: Running the script on a Linux system
os.name = 'posix'
assert(is_windows() is False)

# Test case 2: Running the script on a Windows system
os.name = 'nt'
assert(is_windows() is True)

# Test case 3: Running the script on a different operating system
os.name = 'mac'
assert(is_windows() is False)


# Run the tests
test_is_linux()
test_is_windows()

0 comments on commit 6022d37

Please sign in to comment.