Ignore py files generated by emacs
Added a file ignore for Python files of the form ``.#<name>.py``, which are generated by the Emacs editor. Pull request courtesy Markus Mattes. Change-Id: I06861c2ba7b8e6730948c01ff0690b50bdb26f0f Pull-request: https://github.com/zzzeek/alembic/pull/32 Fixes: #356
This commit is contained in:
parent
fa59029c5d
commit
053062c2ee
|
@ -9,8 +9,8 @@ from ..runtime import migration
|
|||
|
||||
from contextlib import contextmanager
|
||||
|
||||
_sourceless_rev_file = re.compile(r'(?!__init__)(.*\.py)(c|o)?$')
|
||||
_only_source_rev_file = re.compile(r'(?!__init__)(.*\.py)$')
|
||||
_sourceless_rev_file = re.compile(r'(?!\.\#|__init__)(.*\.py)(c|o)?$')
|
||||
_only_source_rev_file = re.compile(r'(?!\.\#|__init__)(.*\.py)$')
|
||||
_legacy_rev = re.compile(r'([a-f0-9]+)\.py$')
|
||||
_mod_def_re = re.compile(r'(upgrade|downgrade)_([a-z0-9]+)')
|
||||
_slug_re = re.compile(r'\w+')
|
||||
|
|
|
@ -6,6 +6,14 @@ Changelog
|
|||
.. changelog::
|
||||
:version: 0.8.10
|
||||
|
||||
.. change:: 356
|
||||
:tags: bug, versioning
|
||||
:tickets: 356
|
||||
|
||||
Added a file ignore for Python files of the form ``.#<name>.py``,
|
||||
which are generated by the Emacs editor. Pull request courtesy
|
||||
Markus Mattes.
|
||||
|
||||
.. changelog::
|
||||
:version: 0.8.9
|
||||
:released: November 28, 2016
|
||||
|
|
|
@ -301,7 +301,7 @@ def downgrade():
|
|||
Script._from_path, script, path)
|
||||
|
||||
|
||||
class IgnoreInitTest(TestBase):
|
||||
class IgnoreFilesTest(TestBase):
|
||||
sourceless = False
|
||||
|
||||
def setUp(self):
|
||||
|
@ -312,12 +312,11 @@ class IgnoreInitTest(TestBase):
|
|||
def tearDown(self):
|
||||
clear_staging_env()
|
||||
|
||||
def _test_ignore_init_py(self, ext):
|
||||
"""test that __init__.py is ignored."""
|
||||
def _test_ignore_file_py(self, fname):
|
||||
|
||||
command.revision(self.cfg, message="some rev")
|
||||
script = ScriptDirectory.from_config(self.cfg)
|
||||
path = os.path.join(script.versions, "__init__.%s" % ext)
|
||||
path = os.path.join(script.versions, fname)
|
||||
with open(path, 'w') as f:
|
||||
f.write(
|
||||
"crap, crap -> crap"
|
||||
|
@ -326,20 +325,42 @@ class IgnoreInitTest(TestBase):
|
|||
|
||||
script.get_revision('head')
|
||||
|
||||
def test_ignore_py(self):
|
||||
def _test_ignore_init_py(self, ext):
|
||||
"""test that __init__.py is ignored."""
|
||||
|
||||
self._test_ignore_file_py("__init__.%s" % ext)
|
||||
|
||||
def _test_ignore_dot_hash_py(self, ext):
|
||||
"""test that .#test.py is ignored."""
|
||||
|
||||
self._test_ignore_file_py(".#test.%s" % ext)
|
||||
|
||||
def test_ignore_init_py(self):
|
||||
self._test_ignore_init_py("py")
|
||||
|
||||
def test_ignore_pyc(self):
|
||||
def test_ignore_init_pyc(self):
|
||||
self._test_ignore_init_py("pyc")
|
||||
|
||||
def test_ignore_pyx(self):
|
||||
def test_ignore_init_pyx(self):
|
||||
self._test_ignore_init_py("pyx")
|
||||
|
||||
def test_ignore_pyo(self):
|
||||
def test_ignore_init_pyo(self):
|
||||
self._test_ignore_init_py("pyo")
|
||||
|
||||
def test_ignore_dot_hash_py(self):
|
||||
self._test_ignore_dot_hash_py("py")
|
||||
|
||||
class SourcelessIgnoreInitTest(IgnoreInitTest):
|
||||
def test_ignore_dot_hash_pyc(self):
|
||||
self._test_ignore_dot_hash_py("pyc")
|
||||
|
||||
def test_ignore_dot_hash_pyx(self):
|
||||
self._test_ignore_dot_hash_py("pyx")
|
||||
|
||||
def test_ignore_dot_hash_pyo(self):
|
||||
self._test_ignore_dot_hash_py("pyo")
|
||||
|
||||
|
||||
class SourcelessIgnoreFilesTest(IgnoreFilesTest):
|
||||
sourceless = True
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue