Giter VIP home page Giter VIP logo

Comments (6)

AArnott avatar AArnott commented on July 4, 2024 1

Closed by #68

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

Most of the attributes in this library are Windows-specific. But UIFact might work for you. It is OS-agnostic, but really the only thing it does is keep the test running on one particular thread even across async awaits.

I'm a bit surprised to hear of a requirement to only be accessed from the "main thread", since in Windows this is virtually indistinguishable from any other thread. Most thread affinitized libraries I see care about either of two other things:

  1. They are not thread-safe, and therefore should only be accessed from one thread, but the particular thread chosen doesn't matter.
  2. They access the UI, so they need to only be accessed on the UI thread.

If your native library actually has one of these two common requirements, I think [UIFact] may work for you. But I'm not sure.

If you try it and find that it's insufficient, and are willing to send a PR to this library to add a new attribute to do what macos requires, comment back on this issue with your proposal and I may take a PR.

from xunit.stafact.

SupinePandora43 avatar SupinePandora43 commented on July 4, 2024

i tried
I'll make this issue a feature request then

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

I'll need to know what you're requesting then. What is it about UIFact that isn't enough for your native library, for example? I don't have a mac, so this isn't a feature I'm likely to be able to do myself without a precise spec. Can you offer one?

from xunit.stafact.

SupinePandora43 avatar SupinePandora43 commented on July 4, 2024

Unfortunately [UIFact] isn't enough. What di you mean by spec? Main thread is main thread, but i guess it is unavailable to be modified in xunit?

from xunit.stafact.

AArnott avatar AArnott commented on July 4, 2024

In Windows, the main thread is the entrypoint thread. No test runner I've seen exposes that for tests. The main thread just sleeps while tests are running (waking up to schedule them, perhaps).
I don't know what it's like on a mac, if macos defines main thread differently. But I suspect the xunit runner on macos is the same, in that it's impossible to get the test to actually run on the entrypoint thread.

So to make progress on this, I think you'll need to research what this native module you're using really means by the main thread. If it means it literally checks to make sure its code is running on the entrypoint thread, there's nothing that can be done there except switch your testing from Xunit to a hand-written exe that runs your own methods as tests. If there are other more flexible requirements about the thread it's on, we may be able to do something here.

from xunit.stafact.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.