コード例 #1
0
 def __init__(self):
     Cmd.__init__(self)
     self.command = command_line.CommandLine()
     print('Welcome to the Python UML creator')
     self.command = command_line.CommandLine()
     self.prompt = ">>> "
     self.cmdloop('Starting prompt...\nType "help" for commands')
コード例 #2
0
 def __init__(self, args):
     self.command = command_line.CommandLine()
     self.comm = None  # command given by user
     self.input_file = None
     self.output_file = 'output.csv'
     self.check_command_line(args)
     self.run_command()
コード例 #3
0
 def test_main_no_playerID(self):
     # The program's values
     sys.argv = ['ScriptedJsonEditor']
     _clo = command_line.CommandLine()
     _playerID = _clo.get_playerID()
     _rF2root = _clo.get_rF2root()
     assert _playerID == 'player', _playerID
     assert _rF2root == 'C:\\Program Files (x86)\\Steam\\steamapps\\common\\rFactor 2', _rF2root
コード例 #4
0
def main():
  """Main executable. Parse the command line and invoke the command."""
  cmdline = command_line.CommandLine()

  # The below two commands are currently unstable so have been disabled
  # commands.compare2.CreateCommand(cmdline)
  # commands.maskmaker.CreateCommand(cmdline)
  commands.measure.CreateCommand(cmdline)
  commands.scrape.CreateCommand(cmdline)

  cmdline.ParseCommandLine()
コード例 #5
0
    def test_main_configFile_playerID(self, mock_os_isfile):
        # The config file's values
        rF2root = r"%ProgramFiles(x86)%\\Steam\\steamapps\\common\\rFactor 2CONFIG"
        sys.argv = ['ScriptedJsonEditor']
        file_content_mock = '{ "player": "playerCONFIG",\n' \
                            ' "rF2root": "%s" }' % rF2root
        fake_file_path = 'ScriptedJsonEditorCfg.json'
        #mock_os_is_file.return_value = True

        with patch('command_line.open', mock_open(read_data=file_content_mock), create=True) as m:
            _clo = command_line.CommandLine()
            _playerID = _clo.get_playerID()
            _rF2root = _clo.get_rF2root()
        assert _playerID == 'playerCONFIG', _playerID
        assert _rF2root == os.path.normpath(
            os.path.expandvars(rF2root)), _rF2root
コード例 #6
0
    def test_main_JSONfileToBeEdited(self):
        sys.argv = ['ScriptedJsonEditor', 'jobs\\VR.json']
        _clo = command_line.CommandLine()
        jobsFile = _clo.get_jobs_file()
        if jobsFile:

            _JSNO_O = ScriptedJsonEditor.JsonJobsFile()
            __, config = _JSNO_O.read(jobsFile)
            _jobs = _JSNO_O.get_jobs()

            if _jobs:
                # Execute
                # For each job in jobsFile
                for job in _jobs:
                    _j = ScriptedJsonEditor.Job(job, config)
                    #   read the file to be edited
                    _j._load(
                        test_test_strings.playerJSONstr,
                        'test_test_strings.playerJSONstr')
            else:
                assert False, 'No jobs in jobs\\VR.json'
        else:
            assert False, r'No jobsfile jobs\VR.json'
コード例 #7
0
 def test_36_command_line_create_csv(self):
     command_line = com_line.CommandLine()
     expected = False
     actual = command_line.create_csv('falsefile')
     self.assertEqual(expected, actual)
コード例 #8
0
 def test_35_command_line_create_csv(self):
     command_line = com_line.CommandLine()
     expected = True
     actual = command_line.create_csv('plants.py')
     self.assertEqual(expected, actual)
コード例 #9
0
 def test_main_playerID(self):
     # The command line switches
     sys.argv = ['ScriptedJsonEditor', '--player', 'playerTEST']
     _clo = command_line.CommandLine()
     _playerID = _clo.get_playerID()
     assert _playerID == 'playerTEST', _playerID