Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/pulp_python/plugins/distributors/steps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from gettext import gettext as _
import logging
import os
from gettext import gettext as _
from xml.etree import cElementTree as ElementTree

from pulp.plugins.util.publish_step import AtomicDirectoryPublishStep, PluginStep
Expand Down
2 changes: 1 addition & 1 deletion plugins/pulp_python/plugins/distributors/web.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
from gettext import gettext as _
import logging
import shutil
from gettext import gettext as _

from pulp.common.config import read_json_config
from pulp.plugins.distributor import Distributor
Expand Down
2 changes: 1 addition & 1 deletion plugins/pulp_python/plugins/importers/importer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from gettext import gettext as _
import shutil
import tempfile
from gettext import gettext as _

from pulp.plugins.importer import Importer
from pulp.server.db.model import criteria
Expand Down
8 changes: 4 additions & 4 deletions plugins/pulp_python/plugins/importers/sync.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""
This module contains the necessary means for a necessary means for syncing packages from PyPI.
"""
from cStringIO import StringIO
from gettext import gettext as _
import json
import logging
import os
import shutil
from cStringIO import StringIO
from gettext import gettext as _
from urlparse import urljoin

from nectar import request
Expand Down Expand Up @@ -151,8 +151,8 @@ def download_succeeded(self, report):
package = models.Package.from_archive(report.destination)
package.init_unit(self.conduit)

# Move the package into its proper place
shutil.move(report.destination, package.storage_path)
# Copy the package from working directory into its proper place
shutil.copy(report.destination, package.storage_path)

package.save_unit(self.conduit)

Expand Down
2 changes: 1 addition & 1 deletion plugins/pulp_python/plugins/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from gettext import gettext as _
import hashlib
import re
import tarfile
from gettext import gettext as _

from pulp_python.common import constants

Expand Down
3 changes: 1 addition & 2 deletions plugins/test/unit/plugins/distributors/test_steps.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""
This module contains tests for the pulp_python.plugins.distributors.steps module.
"""
from gettext import gettext as _
import os
import unittest

from gettext import gettext as _
from xml.etree import cElementTree as ElementTree

import mock
Expand Down
2 changes: 1 addition & 1 deletion plugins/test/unit/plugins/importers/test_importer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
Contains tests for pulp_python.plugins.importers.importer.
"""
import unittest
from gettext import gettext as _
import unittest

import mock

Expand Down
20 changes: 10 additions & 10 deletions plugins/test/unit/plugins/importers/test_sync.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
This module contains tests for the pulp_python.plugins.importers.sync module.
"""
from cStringIO import StringIO
from gettext import gettext as _
import os
import types
import unittest
from cStringIO import StringIO
from gettext import gettext as _

import mock
from pulp.server.db.model import criteria
Expand Down Expand Up @@ -683,8 +683,8 @@ class TestDownloadPackagesStep(unittest.TestCase):
@mock.patch('pulp_python.plugins.importers.sync.models.Package.save_unit')
@mock.patch('pulp_python.plugins.importers.sync.DownloadPackagesStep.download_failed')
@mock.patch('pulp_python.plugins.importers.sync.publish_step.DownloadStep.download_succeeded')
@mock.patch('pulp_python.plugins.importers.sync.shutil.move')
def test_download_succeeded_checksum_bad(self, move, super_download_succeeded,
@mock.patch('pulp_python.plugins.importers.sync.shutil.copy')
def test_download_succeeded_checksum_bad(self, copy, super_download_succeeded,
download_failed, save_unit, checksum):
"""
Test the download_succeeded() method when the checksum of the downloaded package is
Expand All @@ -709,16 +709,16 @@ def test_download_succeeded_checksum_bad(self, move, super_download_succeeded,
download_failed.assert_called_once_with(report)
# Make sure the checksum was calculated with the correct data
checksum.assert_called_once_with(report.destination, 'md5')
# move and save_unit should not have been called since the download failed
self.assertEqual(move.call_count, 0)
# copy and save_unit should not have been called since the download failed
self.assertEqual(copy.call_count, 0)
self.assertEqual(save_unit.call_count, 0)

@mock.patch('pulp_python.plugins.importers.sync.models.Package.checksum')
@mock.patch('pulp_python.plugins.importers.sync.models.Package.from_archive')
@mock.patch('pulp_python.plugins.importers.sync.DownloadPackagesStep.download_failed')
@mock.patch('pulp_python.plugins.importers.sync.publish_step.DownloadStep.download_succeeded')
@mock.patch('pulp_python.plugins.importers.sync.shutil.move')
def test_download_succeeded_checksum_good(self, move, super_download_succeeded, download_failed,
@mock.patch('pulp_python.plugins.importers.sync.shutil.copy')
def test_download_succeeded_checksum_good(self, copy, super_download_succeeded, download_failed,
from_archive, checksum):
"""
Test the download_succeeded() method when the checksum of the downloaded package is correct.
Expand All @@ -740,8 +740,8 @@ def test_download_succeeded_checksum_good(self, move, super_download_succeeded,
# The Package's init_unit should have been handed the conduit
package = from_archive.return_value
package.init_unit.assert_called_once_with(conduit)
# The unit should have been moved to the storage path
move.assert_called_once_with(report.destination, package.storage_path)
# The unit should have been copied to the storage path
copy.assert_called_once_with(report.destination, package.storage_path)
# The unit should have been saved to the DB
package.save_unit.assert_called_once_with(conduit)
# The superclass success method should have been called.
Expand Down
2 changes: 1 addition & 1 deletion plugins/test/unit/plugins/test_models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
This modules contains tests for pulp_python.plugins.models.
"""
from gettext import gettext as _
import hashlib
import re
import tarfile
import unittest
from gettext import gettext as _

import mock

Expand Down