Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work on windows os ? #336

Open
mosi-kha opened this issue Sep 5, 2019 · 4 comments
Open

work on windows os ? #336

mosi-kha opened this issue Sep 5, 2019 · 4 comments

Comments

@mosi-kha
Copy link

mosi-kha commented Sep 5, 2019

hi, is this library just work on UNIX os?
because in windows os I have this error :
AttributeError: module 'select' has no attribute 'poll' and poll just implemented in UNIX platforms.

@fizyk
Copy link
Member

fizyk commented Sep 5, 2019

We do test and make sure it works on MacOS and linux. You might get luck and it might be working on Windows Subsystem for Linux (WSL), otherwise, we'd welcome any contribution.

@mybr4inhurts
Copy link

mybr4inhurts commented May 5, 2020

Also os.killpg(self.process.pid, sig) is not available in Windows.

Therefore tearing down pytests is not possible as mirakuru cannot kill the mongodb process. This causes that the database folder still exists in your user profile /user/username/appdata/local/temp/mongodb.PORT

Rerunning tests is always a hassle. You have to manually kill the mongod process in taskmanager and then manually delete the mongodb folder in your profile before you are able to rerun your tests.

I have tried fixing this locally in mirakuru.base.py with replacing killpg with any of

os.kill(self.process.pid, signal.CTRL_C_EVENT), 
os.kill(self.process.pid, signal.CTRL_BREAK_EVENT)

and

subprocess.call(['taskkill', '/F', '/T', '/PID', str(self.process.pid)])

This will eventually kill the mongod process but tearing down the test still doesn't work. The mongodb folder will not be deleted.

You will get another mirakuru exception for the process exiting with a non zero exit code.

        # Did the process shut down cleanly? A an exit code of `-sig` means
        # that it has terminated due to signal `sig`, which is intended. So
        # don't treat that as an error.
        if exit_code and exit_code != -sig:
>           raise ProcessFinishedWithError(self, exit_code)
E           mirakuru.exceptions.ProcessFinishedWithError: The process invoked by the <mirakuru.tcp.TCPExecutor: ""mongod" --bind_ip 127.0.0.1 --port 27020 --dbpath C:\Users\User\AppData\Local\Temp\mongo.27020 --logpath C:\Users\User\AppData\Local\Temp\mongo.27020.log " 0x43d29e8> executor has exited with a non-zero code: 1.

the corresponding test code (simplified):

@staticmethod
    @pytest.fixture()
    def schema_listener_mongo_proc(mongo_proc):
        client = MongoClient(f'mongodb://{mongo_proc.host}:{mongo_proc.port}')

        while not client.nodes:
            time.sleep(0.1)

        yield SchemaChangeListener(client, logging.getLogger(__name__))

        [...] 
        # just dropping existing collections here (ignoring config collection)

@fizyk
Copy link
Member

fizyk commented May 8, 2020

@mybr4inhurts mirakuru doesn't support windows at the moment, I've created task to add it #392 however I'm not sure when I'll find the time to do this

@eruvanos
Copy link

Windows support would be really nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants