diff tests/conftest.py @ 1028:63f118c773ee

tests: Prevent conflicts in later `pytest` versions.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 25 Dec 2017 23:05:49 -0800
parents 45ad976712ec
children 2aa6174453c8
line wrap: on
line diff
--- a/tests/conftest.py	Mon Dec 25 19:02:05 2017 -0800
+++ b/tests/conftest.py	Mon Dec 25 23:05:49 2017 -0800
@@ -19,24 +19,24 @@
 
 def pytest_addoption(parser):
     parser.addoption(
-        '--log-debug',
+        '--pc-log-debug',
         action='store_true',
         help="Sets the PieCrust logger to output debug info to stdout.")
     parser.addoption(
-        '--log-file',
+        '--pc-log-file',
         help="Sets the PieCrust logger to write to a file.")
     parser.addoption(
-        '--mock-debug',
+        '--pc-mock-debug',
         action='store_true',
         help="Prints contents of the mock file-system.")
     parser.addoption(
-        '--leave-mockfs',
+        '--pc-leave-mockfs',
         action='store_true',
         help="Leave the contents of the mock file-system on disk.")
 
 
 def pytest_configure(config):
-    if config.getoption('--log-debug'):
+    if config.getoption('--pc-log-debug'):
         root_logger = logging.getLogger()
         hdl = logging.StreamHandler(stream=sys.stdout)
         root_logger.addHandler(hdl)
@@ -46,13 +46,13 @@
         TestFileSystemBase._use_chef_debug = True
         TestFileSystemBase._pytest_log_handler = hdl
 
-    log_file = config.getoption('--log-file')
+    log_file = config.getoption('--pc-log-file')
     if log_file:
         hdl = logging.StreamHandler(
             stream=open(log_file, 'w', encoding='utf8'))
         logging.getLogger().addHandler(hdl)
 
-    if config.getoption('--leave-mockfs'):
+    if config.getoption('--pc-leave-mockfs'):
         from .basefs import TestFileSystemBase
         TestFileSystemBase._leave_mockfs = True
 
@@ -101,7 +101,7 @@
 
     @property
     def mock_debug(self):
-        return bool(self.config.getoption('--mock-debug'))
+        return bool(self.config.getoption('--pc-mock-debug'))
 
     def _prepareMockFs(self):
         fs = mock_fs()