Python: fix up testing script
- Didn't run at all (at least since v3.1) because of mismatch between GlobalStorage constructor arguments and use; special-case None in the C++ code to allocate a new GlobalStorage object.
This commit is contained in:
parent
f509000215
commit
d4c714c400
@ -18,12 +18,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "JobQueue.h"
|
||||||
|
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#ifdef WITH_PYTHON
|
#ifdef WITH_PYTHON
|
||||||
#include "PythonHelper.h"
|
#include "PythonHelper.h"
|
||||||
|
|
||||||
|
|
||||||
#undef slots
|
#undef slots
|
||||||
#include <boost/python/list.hpp>
|
#include <boost/python/list.hpp>
|
||||||
#include <boost/python/str.hpp>
|
#include <boost/python/str.hpp>
|
||||||
@ -99,8 +101,13 @@ GlobalStorage::debugDump() const
|
|||||||
namespace CalamaresPython
|
namespace CalamaresPython
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// The special handling for nullptr is only for the testing
|
||||||
|
// script for the python bindings, which passes in None;
|
||||||
|
// normal use will have a GlobalStorage from JobQueue::instance()
|
||||||
|
// passed in. Testing use will leak the allocated GlobalStorage
|
||||||
|
// object, but that's OK for testing.
|
||||||
GlobalStoragePythonWrapper::GlobalStoragePythonWrapper( Calamares::GlobalStorage* gs )
|
GlobalStoragePythonWrapper::GlobalStoragePythonWrapper( Calamares::GlobalStorage* gs )
|
||||||
: m_gs( gs )
|
: m_gs( gs ? gs : new Calamares::GlobalStorage )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
# === This file is part of Calamares - <http://github.com/calamares> ===
|
# === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
#
|
#
|
||||||
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
# Copyright 2014, Teo Mrnjavac <teo@kde.org>
|
||||||
|
# Copyright 2017, Adriaan de Groot <groot@kde.org>
|
||||||
#
|
#
|
||||||
# Calamares is free software: you can redistribute it and/or modify
|
# Calamares is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -81,7 +82,9 @@ def main():
|
|||||||
print("Only Python jobs can be tested.")
|
print("Only Python jobs can be tested.")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
libcalamares.globalstorage = libcalamares.GlobalStorage()
|
# Parameter None creates a new, empty GlobalStorage
|
||||||
|
libcalamares.globalstorage = libcalamares.GlobalStorage(None)
|
||||||
|
libcalamares.globalstorage.insert("testing", True)
|
||||||
|
|
||||||
# if a file for simulating globalStorage contents is provided, load it
|
# if a file for simulating globalStorage contents is provided, load it
|
||||||
if args.globalstorage_yaml:
|
if args.globalstorage_yaml:
|
||||||
|
Loading…
Reference in New Issue
Block a user