##// END OF EJS Templates
Reduce the number of test on Appveyor....
Reduce the number of test on Appveyor. Appveyor is way slower than Travis, in part because we test on more architecture. In particular 32 and 64 bits. And accumulate delay sometime leading to 30 min between travis success and AppVeyor response. 32 Bits OSes are starting to be rare (or not our target, like tablets). Less that 1/5 market share is some survey, and account for more than 2/3 of our testing time. So slash 3 out of 4 testing on 32 bits. Test only python 3.6 32 bits. (I know that's paradoxal are mostly old system are 32 bits... but do we expect people with old system and old python to use new IPython ?) For example: Windows Arch Share Windows 10 64 bit 36.97% Windows 7 64 bit 32.99% Windows 8.1 64 bit 12.93% Windows 8 64 bit 1.64% Windows Vista 64 bit 0.13% Windows 7 32 bit 6.97% Windows XP 32 bit 2.00% Windows 10 32 bit 1.31% Windows 8.1 32 bit 0.34% Windows Vista 32 bit 0.24% Windows 8 32 bit 0.15% Total about 83ish % of 64 bits. Source: http://www.digitaltrends.com/computing/steam-users-windows-10-market-share/ and http://store.steampowered.com/hwsurvey?platform=pc

File last commit:

r22633:18d1281c
r23236:a8f84d57
Show More
contexts.py
74 lines | 1.9 KiB | text/x-python | PythonLexer
# encoding: utf-8
"""Miscellaneous context managers.
"""
import warnings
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
class preserve_keys(object):
"""Preserve a set of keys in a dictionary.
Upon entering the context manager the current values of the keys
will be saved. Upon exiting, the dictionary will be updated to
restore the original value of the preserved keys. Preserved keys
which did not exist when entering the context manager will be
deleted.
Examples
--------
>>> d = {'a': 1, 'b': 2, 'c': 3}
>>> with preserve_keys(d, 'b', 'c', 'd'):
... del d['a']
... del d['b'] # will be reset to 2
... d['c'] = None # will be reset to 3
... d['d'] = 4 # will be deleted
... d['e'] = 5
... print(sorted(d.items()))
...
[('c', None), ('d', 4), ('e', 5)]
>>> print(sorted(d.items()))
[('b', 2), ('c', 3), ('e', 5)]
"""
def __init__(self, dictionary, *keys):
self.dictionary = dictionary
self.keys = keys
def __enter__(self):
# Actions to perform upon exiting.
to_delete = []
to_update = {}
d = self.dictionary
for k in self.keys:
if k in d:
to_update[k] = d[k]
else:
to_delete.append(k)
self.to_delete = to_delete
self.to_update = to_update
def __exit__(self, *exc_info):
d = self.dictionary
for k in self.to_delete:
d.pop(k, None)
d.update(self.to_update)
class NoOpContext(object):
"""
Deprecated
Context manager that does nothing."""
def __init__(self):
warnings.warn("""NoOpContext is deprecated since IPython 5.0 """,
DeprecationWarning, stacklevel=2)
def __enter__(self): pass
def __exit__(self, type, value, traceback): pass