Skip to content

Commit

Permalink
Don't import spwd for tests on non Linux OS
Browse files Browse the repository at this point in the history
  • Loading branch information
piterpunk authored and garethgreenaway committed May 7, 2021
1 parent 0f777f5 commit 5dfb901
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/unit/modules/test_linux_shadow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
:codeauthor: Erik Johnson <erik@saltstack.com>
"""

import spwd
import textwrap

import pytest
Expand All @@ -12,14 +11,18 @@
from tests.support.mock import DEFAULT, MagicMock, mock_open, patch
from tests.support.unit import TestCase, skipIf

try:
import spwd
except ImportError:
pass

try:
import salt.modules.linux_shadow as shadow

HAS_SHADOW = True
except ImportError:
HAS_SHADOW = False


_PASSWORD = "lamepassword"

# Not testing blowfish as it is not available on most Linux distros
Expand Down

0 comments on commit 5dfb901

Please sign in to comment.