Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Remove Python 2 leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
locriandev committed May 9, 2022
1 parent 02e0028 commit 375eafc
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 29 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Expand Up @@ -19,7 +19,7 @@ RUN update-ca-trust && \
rpm --import RPM-GPG-KEY-rcminternal && \
curl -O https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && \
yum install -y epel-release-latest-7.noarch.rpm && \
INSTALL_PKGS="podman git tito koji python2-brewkoji rhpkg krb5-devel python-devel python2-pip gcc" && \
INSTALL_PKGS="podman git tito koji python3-brewkoji rhpkg krb5-devel python-devel python3-pip gcc" && \
yum install -y $INSTALL_PKGS && \
rpm -V $INSTALL_PKGS && \
yum clean all && \
Expand Down
2 changes: 1 addition & 1 deletion container_install.sh
Expand Up @@ -30,7 +30,7 @@ yum install -y epel-release-latest-7.noarch.rpm
# rpm -Uvh http://download.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/AtomicOpenShift/4.0/v4.0.0-0.185.0_2019-02-25.1/x86_64/os/Packages/atomic-openshift-clients-4.0.0-0.185.0.git.0.e883da2.el7.x86_64.rpm

# Installing misc dependencies...
INSTALL_PKGS="podman git tito koji python2-brewkoji rhpkg krb5-devel python-devel python2-pip gcc"
INSTALL_PKGS="podman git tito koji python3-brewkoji rhpkg krb5-devel python-devel python3-pip gcc"
yum install -y $INSTALL_PKGS
rpm -V $INSTALL_PKGS
yum clean all
Expand Down
12 changes: 0 additions & 12 deletions doozerlib/assertion.py
Expand Up @@ -8,18 +8,6 @@
import os
import errno

# Create FileNotFound for Python2
try:
import FileNotFoundError
except ImportError:
FileNotFoundError = IOError

# Create ChildProcessError for Python2
try:
import ChildProcessError
except ImportError:
ChildProcessError = IOError


def isdir(path, message):
"""
Expand Down
5 changes: 0 additions & 5 deletions functional_tests/README.md
Expand Up @@ -20,13 +20,8 @@ Then run the test suite using any tool that is compatible with Python unittest f

# Run with Python 3
python3 -m unittest discover -s functional_tests/
# Run with Python 2
python2 -m unittest discover -s functional_tests/
# Use Pytest with Python 3
python3 -m pytest functional_tests/
# Use Pytest with Python 3
Python 2
python2 -m pytest functional_tests/
```

## Known Issues
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Expand Up @@ -103,7 +103,7 @@ show_cmd sudo dnf install -y imagebuilder.rpm

printf "${GREEN}Installing misc dependencies...${NC}\n"

show_cmd sudo dnf install -y git tito koji rhpkg krb5-devel python2-devel python2-pip python2-rpm gcc
show_cmd sudo dnf install -y git tito koji rhpkg krb5-devel python3-devel python3-pip python3-rpm gcc

printf "${GREEN}Upgrading pip...${NC}\n"

Expand Down
16 changes: 8 additions & 8 deletions tests/test_assertion.py
Expand Up @@ -22,15 +22,15 @@ def test_isdir(self):

try:
assertion.isdir(dir_exists, "dir missing: {}".format(dir_exists))
except assertion.FileNotFoundError as fnf_error:
except FileNotFoundError as fnf_error:
self.fail("asserted real directory does not exist: {}".
format(fnf_error))

with self.assertRaises(assertion.FileNotFoundError):
with self.assertRaises(FileNotFoundError):
assertion.isdir(dir_missing, "dir missing: {}".format(dir_missing))

# This should raise NotADirectory
with self.assertRaises(assertion.FileNotFoundError):
with self.assertRaises(FileNotFoundError):
assertion.isdir(not_dir, "file, not dir: {}".format(not_dir))

def test_isfile(self):
Expand All @@ -43,17 +43,17 @@ def test_isfile(self):

try:
assertion.isfile(file_exists, "file missing: {}".format(file_exists))
except assertion.FileNotFoundError as fnf_error:
except FileNotFoundError as fnf_error:
self.fail("asserted real file does not exist: {}".format(fnf_error))

with self.assertRaises(assertion.FileNotFoundError):
with self.assertRaises(FileNotFoundError):
assertion.isfile(
file_missing,
"file missing: {}".format(file_missing)
)

# Should raise IsADirectory
with self.assertRaises(assertion.FileNotFoundError):
with self.assertRaises(FileNotFoundError):
assertion.isfile(not_file, "dir, not file: {}".format(not_file))

def test_success(self):
Expand All @@ -64,10 +64,10 @@ def test_success(self):
# When we move to Python 3 this will raise ChildProcessError directly
try:
assertion.success(0, "this should not fail")
except assertion.ChildProcessError as proc_fail:
except ChildProcessError as proc_fail:
self.fail("success reported as fail: {}".format(proc_fail))

with self.assertRaises(assertion.ChildProcessError):
with self.assertRaises(ChildProcessError):
assertion.success(1, "process failed")


Expand Down
2 changes: 1 addition & 1 deletion tests/test_exectools.py
Expand Up @@ -225,7 +225,7 @@ def test_cmd_assert_async(self):

with mock.patch("doozerlib.exectools.cmd_gather_async") as cmd_gather_async:
cmd_gather_async.return_value = (1, "fake_stdout", "fake_stderr")
with self.assertRaises(assertion.ChildProcessError):
with self.assertRaises(ChildProcessError):
out, err = loop.run_until_complete(exectools.cmd_assert_async(cmd, cwd=fake_cwd, text_mode=True))
cmd_gather_async.assert_called_once_with(cmd, text_mode=True, cwd=fake_cwd, set_env=None, strip=False, log_stdout=False, log_stderr=True)
self.assertEqual(out, "fake_stdout")
Expand Down

0 comments on commit 375eafc

Please sign in to comment.