Commit 2bfa22ca authored by Andreas Tille's avatar Andreas Tille
Browse files

Exclude several tests that try to access remote sites

parent c4df5a4b
Loading
Loading
Loading
Loading
+121 −0
Original line number Diff line number Diff line
FIXME: useless debugging stuff - should be deleted

--- a/tests/test_create.py
+++ b/tests/test_create.py
@@ -239,6 +239,7 @@ def make_temp_channel(packages):
 
 def create_temp_location():
     tempdirdir = gettempdir()
+    print("DEBUG: ", tempdirdir)
     dirname = str(uuid4())[:8]
     return join(tempdirdir, dirname)
 
--- a/tests/test_plan.py
+++ b/tests/test_plan.py
@@ -25,8 +25,12 @@ from .decorators import skip_if_no_mock
 from .gateways.disk.test_permissions import tempdir
 from .helpers import captured, get_index_r_1, mock, tempdir
 
-index, r, = get_index_r_1()
-index = index.copy()  # create a shallow copy so this module can mutate state
+try:
+    index, r, = get_index_r_1()
+    index = index.copy()  # create a shallow copy so this module can mutate state
+except:
+    print("DEBUG: something went wrong")
+
 
 try:
     from unittest.mock import patch
@@ -1481,6 +1485,7 @@ def test_pinned_specs():
     specs_2 = tuple(MatchSpec(spec_str, optional=True) for spec_str in specs_str_2)
 
     with tempdir() as td:
+        print("DEBUG", td)
         mkdir_p(join(td, 'conda-meta'))
         with open(join(td, 'conda-meta', 'pinned'), 'w') as fh:
             fh.write("\n".join(specs_str_2))
@@ -1491,6 +1496,7 @@ def test_pinned_specs():
 
     # Test pinned specs conda configuration and pinned specs conda environment file
     with tempdir() as td:
+        print("DEBUG", td)
         mkdir_p(join(td, 'conda-meta'))
         with open(join(td, 'conda-meta', 'pinned'), 'w') as fh:
             fh.write("\n".join(specs_str_1))
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -165,7 +165,11 @@ def get_index_r_1(subdir=context.subdir)
         }
 
     channel = Channel('https://conda.anaconda.org/channel-1/%s' % subdir)
-    sd = SubdirData(channel)
+    sys.stderr.write("DEBUG stderr: %s\n" % channel)
+    try:
+        sd = SubdirData(channel)
+    except:
+        sys.stderr.write("SubdirData FAILED: DEBUG stderr: Subdir: %s\n" % str(sd))
     with env_var("CONDA_ADD_PIP_AS_PYTHON_DEPENDENCY", "false", reset_context):
         sd._process_raw_repodata_str(json.dumps(repodata))
     sd._loaded = True
--- a/conda/core/subdir_data.py
+++ b/conda/core/subdir_data.py
@@ -53,19 +53,24 @@ REPODATA_PICKLE_VERSION = 28
 MAX_REPODATA_VERSION = 1
 REPODATA_HEADER_RE = b'"(_etag|_mod|_cache_control)":[ ]?"(.*?[^\\\\])"[,\}\s]'  # NOQA
 
+import sys
 
 class SubdirDataType(type):
 
     def __call__(cls, channel):
+        sys.stderr.write("DEBUG stderr SubdirDataType: %s\n" % channel.subdir)
         assert channel.subdir
+        sys.stderr.write("DEBUG stderr SubdirDataType: %s\n" % channel.package_filename)
         assert not channel.package_filename
         assert type(channel) is Channel
         cache_key = channel.url(with_credentials=True)
+        sys.stderr.write("DEBUG stderr SubdirDataType: %s\n" % cache_key)
         if not cache_key.startswith('file://') and cache_key in SubdirData._cache_:
             return SubdirData._cache_[cache_key]
 
         subdir_data_instance = super(SubdirDataType, cls).__call__(channel)
         SubdirData._cache_[cache_key] = subdir_data_instance
+        sys.stderr.write("DEBUG stderr SubdirDataType: %s\n" % subdir_data_instance)
         return subdir_data_instance
 
 
@@ -219,6 +224,7 @@ class SubdirData(object):
         except Response304ContentUnchanged:
             log.debug("304 NOT MODIFIED for '%s'. Updating mtime and loading from disk",
                       self.url_w_subdir)
+            sys.stderr.write("conda/core/subdir_data.py _load() DEBUG stderr: self.cache_path_json = %s\n" % self.cache_path_json)
             touch(self.cache_path_json)
             _internal_state = self._read_local_repdata(mod_etag_headers.get('_etag'),
                                                        mod_etag_headers.get('_mod'))
--- a/conda/gateways/disk/update.py
+++ b/conda/gateways/disk/update.py
@@ -88,6 +88,8 @@ def backoff_rename(source_path, destinat
     exp_backoff_fn(rename, source_path, destination_path, force)
 
 
+import sys
+
 def touch(path, mkdir=False, sudo_safe=False):
     # sudo_safe: use any time `path` is within the user's home directory
     # returns:
@@ -96,12 +98,14 @@ def touch(path, mkdir=False, sudo_safe=F
     # raises: NotWritableError, which is also an OSError having attached errno
     try:
         path = expand(path)
+        sys.stderr.write("conda/gateways/disk/update.py touch() FAILED: DEBUG stderr: path = %s\n" % path)
         log.trace("touching path %s", path)
         if lexists(path):
             os.utime(path, None)
             return True
         else:
             dirpath = dirname(path)
+            sys.stderr.write("conda/gateways/disk/update.py touch() FAILED: DEBUG stderr: dirname = %s\n" % dirname)
             if not isdir(dirpath) and mkdir:
                 if sudo_safe:
                     mkdir_p_sudo_safe(dirpath)
+48 −0
Original line number Diff line number Diff line
--- a/tests/test_info.py
+++ b/tests/test_info.py
@@ -40,7 +40,7 @@ def test_info():
     assert_in(conda_info_e_out, conda_info_all_out)
     assert_in(conda_info_s_out, conda_info_all_out)
 
-
+@pytest.mark.skipif(True, reason="Debian: seems to access network")
 @pytest.mark.integration
 def test_info_package_json():
     out, err, rc = run_command(Commands.INFO, "--json", "numpy=1.11.0=py35_0")
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -89,7 +89,7 @@ def test_Solver_inputs_contract():
     ))
     inspect_arguments(Solver.solve_for_transaction, solve_for_transaction_args)
 
-
+@pytest.mark.skipif(True, reason="Debian: access to network")
 @pytest.mark.integration
 def test_Solver_return_value_contract():
     solver = Solver('/', (Channel('pkgs/main'),), specs_to_add=('openssl',))
@@ -140,6 +140,7 @@ def test_SubdirData_contract():
     inspect_arguments(SubdirData.reload, reload_args)
 
 
+@pytest.mark.skipif(True, reason="Debian: access to network")
 @pytest.mark.integration
 def test_SubdirData_return_value_contract():
     sd = SubdirData(Channel('pkgs/main/linux-64'))
@@ -266,6 +267,7 @@ def test_PrefixData_contract():
     inspect_arguments(PrefixData.reload, reload_args)
 
 
+@pytest.mark.skipif(True, reason="Debian: access to network")
 def test_PrefixData_return_value_contract():
     pd = PrefixData(context.conda_prefix)
 
--- a/tests/test_fetch.py
+++ b/tests/test_fetch.py
@@ -15,6 +15,7 @@ from conda.core.subdir_data import fetch
 from conda.core.package_cache_data import download
 
 
+@pytest.mark.skipif(True, reason="Debian: access to network")
 @pytest.mark.integration
 class TestConnectionWithShortTimeouts(TestCase):
 
+61 −0
Original line number Diff line number Diff line
@@ -15,3 +15,64 @@ Description: For some strange reason ruamel.yaml is named ruamel_yaml
 
 from . import support_file
 from .utils import make_temp_envs_dir, Commands, run_command
@@ -352,6 +352,8 @@ class EnvironmentSaveTestCase(unittest.T
         self.assertEqual(e.to_yaml(), actual)
 
 
+import pytest
+@pytest.mark.skipif(True, reason="Debian: access to network")
 class SaveExistingEnvTestCase(unittest.TestCase):
     def test_create_advanced_pip(self):
         with make_temp_envs_dir() as envs_dir:
--- a/tests/core/test_index.py
+++ b/tests/core/test_index.py
@@ -55,12 +55,14 @@ class GetIndexIntegrationTests(TestCase)
         for dist, record in iteritems(index):
             assert platform_in_record(linux64, record), (linux64, record.url)
 
+    @pytest.mark.skipif(True, reason="Debian: not Linux")
     def test_get_index_osx64_platform(self):
         osx64 = 'osx-64'
         index = get_index(platform=osx64)
         for dist, record in iteritems(index):
             assert platform_in_record(osx64, record), (osx64, record.url)
 
+    @pytest.mark.skipif(True, reason="Debian: not Linux")
     def test_get_index_win64_platform(self):
         win64 = 'win-64'
         index = get_index(platform=win64)
@@ -71,6 +73,7 @@ class GetIndexIntegrationTests(TestCase)
 @pytest.mark.integration
 class ReducedIndexTests(TestCase):
 
+    @pytest.mark.skipif(True, reason="Debian: access to network")
     def test_basic_get_reduced_index(self):
         get_reduced_index(None, (Channel('defaults'), Channel('conda-test')), context.subdirs,
                           (MatchSpec('flask'), ))
--- a/tests/test_history.py
+++ b/tests/test_history.py
@@ -9,7 +9,7 @@ from conda.exceptions import CondaUpgrad
 from conda.gateways.disk import mkdir_p
 from .decorators import skip_if_no_mock
 from .helpers import mock, tempdir
-from .test_create import make_temp_prefix
+#from .test_create import make_temp_prefix
 
 from conda.history import History
 from conda.resolve import MatchSpec
@@ -41,6 +41,7 @@ class HistoryTestCase(unittest.TestCase)
                 with h as h2:
                     self.assertEqual(h, h2)
 
+    @pytest.mark.skipif(True, reason="Debian: access to network")
     @skip_if_no_mock
     def test_empty_history_check_on_empty_env(self):
         with mock.patch.object(History, 'file_is_empty') as mock_file_is_empty:
@@ -51,6 +52,7 @@ class HistoryTestCase(unittest.TestCase)
         self.assertEqual(mock_file_is_empty.call_count, 1)
         assert not h.file_is_empty()
 
+    @pytest.mark.skipif(True, reason="Debian: access to network")
     @skip_if_no_mock
     def test_parse_on_empty_env(self):
         with mock.patch.object(History, 'parse') as mock_parse:
+1 −0
Original line number Diff line number Diff line
do_not_use_git_in_configure.patch
skip_tests_needing_conda-build.patch
ruamel_yaml_name.patch
ignore_test_accessing_remote.patch
+19 −0
Original line number Diff line number Diff line
@@ -17,6 +17,10 @@ include /usr/share/dpkg/default.mk
# for hardening you might like to uncomment this:
# export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# Silence tests that try to access internet
export  http_proxy=http://127.0.0.1:9/
export  https_proxy=http://127.0.0.1:9/

%:
	dh $@ --with python3 --buildsystem=pybuild

@@ -30,5 +34,20 @@ override_dh_auto_configure:

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# ignore tests trying to access remote locations
	mkdir $(CURDIR)/tmp_test_ignore
	mkdir $(CURDIR)/tmp_test_ignore/conda_env
	mv \
	    tests/test_cli.py \
	    tests/test_create.py \
	    tests/test_export.py \
	    tests/test_priority.py \
	    $(CURDIR)/tmp_test_ignore
	mv \
	    tests/conda_env/test_cli.py \
	    tests/conda_env/test_create.py \
	    $(CURDIR)/tmp_test_ignore/conda_env
	CONDA_PKGS_DIRS=/tmp/pkgs dh_auto_test
	# restore all tests
	mv $(CURDIR)/tmp_test_ignore/* tests
endif